UITableView失去选择 [英] UITableView loses selection
本文介绍了UITableView失去选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的UITableView选择有问题。
如果我点击编辑按钮,TableView进入编辑模式并失去当前选择。
I have a problem with the UITableView Selection. If I click on the edit button the TableView goes into edit mode and loses the current selection.
如何在不丢失选择的情况下进入编辑模式?
How can I go into the edit mode without losing the selection?
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the specified item to be editable.
return YES;
}
推荐答案
我是能够重现它:如果您选择这样的行 [self.tableView selectRowAtIndexPath:]
,单元格将失去其选择。
但是如果直接选择单元格,它就不会丢失编辑选项,如下所示:
I was able to reproduce it: if you select the row like this [self.tableView selectRowAtIndexPath:]
the cell loses its selection.
But if you select the cell directly, it doesn't lose the selection on edit, something like this:
UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:
[NSIndexPath indexPathForRow:1 inSection:0]];
[cell setSelected:YES animated:NO];
这篇关于UITableView失去选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文