gpt4 book ai didi

iphone - Tableview推送到不同的 View

转载 作者:行者123 更新时间:2023-11-29 04:17:00 25 4
gpt4 key购买 nike

我有这段代码,当按下单元格时,它会推送到新 View 。这个新 View 根据按下的单元格的名称更改其标题。但是,所有单元格的 View 都是相同的,如果我更改一个单元格下的某些内容,它会更改每个其他单元格的 View 。我怎样才能做到这一点,以便每个单元格的每个 View 都不同,而不创建大量 View ;这是不切实际的。谢谢。

推送代码:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];

ACollection *newView = [[ACollection alloc] init];
newView.template = [[Global collections] objectAtIndex:indexPath.row];

newView.theTitle = [self.tableView cellForRowAtIndexPath:indexPath].textLabel.text;
[self.navigationController pushViewController:newView animated:YES];
}

最佳答案

theTitle 似乎是您在单元格选择时设置的局部变量。但是,导航 Controller 在导航项中设置 View Controller 的标题。因此,您可以像这样设置 AVCollections 标题:

newView.navigationItem.title = [self.tableView cellForRowAtIndexPath:indexPath].textLabel.text;

在细胞选择期间。

关于iphone - Tableview推送到不同的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13561706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com