gpt4 book ai didi

ios - 更改电池附件类型?

转载 作者:行者123 更新时间:2023-11-29 10:56:05 24 4
gpt4 key购买 nike

我有一个名为 allone.h 的表格 View ,其中的单元格都是带有披露指示器的字幕样式单元格。
字幕文本是动态生成的,因此很可能每个单元格都有不同的字幕文本。

我有一个 if 语句,它说 if the text = "hello, world",然后将附件类型更改为 detailDisclosureIndicator。当按下 detailDisclosureIndicator 时,它会推送一个新 Controller ,更改字幕文本,然后弹出该 View Controller 并返回到 allone.h。问题是,它仍然显示 detailDisclosureIndicator,即使 if the text != "hello, world"。我尝试更改 viewWillAppear 中的样式,但我无法访问单元格。

这是我的代码。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//populate cells with stuff

if([cell.detailTextLabel.text isEqualToString:@"hello, world"]){
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
}

所以我想我的问题是,当我返回 allone.h 并且单元格的文本不再是“hello, world”时,如何更改附件类型back “?

最佳答案

您可以在您的 -[UITableView cellForRowAtIndexPath:] 中执行此操作。就像您的 if 语句的“else”一样。

要重新加载单元格,您只需调用 reloadData 或 reloadRowsAtIndexPaths:withRowAnimation:。

关于ios - 更改电池附件类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18371571/

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