gpt4 book ai didi

iphone - 在行选择上更改 UITableView accessoryView

转载 作者:技术小花猫 更新时间:2023-10-29 11:18:25 26 4
gpt4 key购买 nike

我试图在选择行时更改 UITableViewCell 的附属 View ,我有以下代码:

- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell* cell = [self tableView:aTableView cellForRowAtIndexPath:indexPath];
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
[activityView startAnimating];
cell.accessoryView = activityView;
[activityView release];
}

但这行不通。有什么想法吗?

最佳答案

您不应该向表格 View 数据源(您自己)询问单元格。因为这将创建一个新的单元格,它只是不显示。

替换

UITableViewCell* cell = [self tableView:aTableView cellForRowAtIndexPath:indexPath];

UITableViewCell *cell = [aTableView cellForRowAtIndexPath:indexPath];

关于iphone - 在行选择上更改 UITableView accessoryView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5257053/

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