gpt4 book ai didi

iphone - 在 TableView 中添加 UITableViewCellAccessoryDe​​tailDisclosureButton - 初学者

转载 作者:行者123 更新时间:2023-12-03 21:05:22 24 4
gpt4 key购买 nike

我在 UITableView 中的某些单元格上有一个 UITableViewCellAccessoryDe​​tailDisclosureButton,当我滚动表格时,UITableViewCellAccessoryDe​​tailDisclosureButton 出现在不应该显示 UITableViewCellAccessoryDe​​tailDisclosureButton 按钮。有人可以告诉我为什么会发生这种情况以及如何防止它。

我已在以下代码中输入添加 UITableViewCellAccessoryDe​​tailDisclosureButton 的代码:

if (cell == nil) {

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

最佳答案

在 TableView 委托(delegate)中尝试以下操作:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// Replace with your Row/cell check...
if (indexPath.row % 2) {
cell.accessoryType = UITableViewCellAccessoryNone;
} else {
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
}

关于iphone - 在 TableView 中添加 UITableViewCellAccessoryDe​​tailDisclosureButton - 初学者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7759555/

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