2013-10-07 49 views
0

我有一个UITableView,当点击一个按钮时显示,它应该显示一个单元格上的复选标记附件,该单元使用基于数组中的特定字符串(填充表视图的数组)来确定在其索引上。我在viewDidLoad方法如下代码:UITableViewCell不显示复选标记配件

NSIndexPath *indexPath = [NSIndexPath indexPathWithIndex:[arrayOfSounds indexOfObject:currentSound]];
UITableViewCell *cell = [tableViewProperty cellForRowAtIndexPath:indexPath];
[cell setAccessoryType: UITableViewCellAccessoryCheckmark];

但一些为什么它不显示正确的选中标记。
currentSound变量是一个字符串,它具有正确的文本,因为我在调试期间检查过。请指教!

+1

该代码在哪里执行?它是在UITableView或其他地方的委托方法吗? – JuJoDi

+0

@JuJoDi它在'UITableViewController'和'tableViewProperty'子类的'viewDidLoad'方法中执行,指向Interface Builder中的表视图,其中这个类是表视图的委托和数据源。 –

回答

1

您应该使用的tableView的

- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation (UITableViewRowAnimation)animation; 

重新装入电池。

相关问题