我正在关注本教程:https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/ThirdTutorial.html#//apple_ref/doc/uid/TP40011343-CH10-SW1 , 在那里你有一个表格 View 。 TableView 具有动态原型(prototype)单元。 在教程中,我在 Storyboard上选择了一个单元格,并将“选择”类型设置为:无。 但在教程的最后部分,我们仍然被告知添加
[tableView deselectRowAtIndexPath:indexPath animated:NO];
行内
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
方法。
对我来说,这似乎是多余的,因为我按照上面的操作,“选择”是无。 还是我错了?由于我在 Storyboard(对于单元格)中选择了无作为选择,为什么我们需要取消选择方法?无论如何,该单元格都不会突出显示,不是吗?
最佳答案
该行仍处于选中状态。 “无”样式仅与选择时的外观有关。
所以,是的,您需要在完成后取消选择该行。
关于ios - deselectRowAtIndexPath - 是否需要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21319696/