- (voID)tableVIEw:(UItableVIEw *)tableVIEw willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath;- (voID)tableVIEw:(UItableVIEw *)tableVIEw dIDEndEditingRowAtIndexPath:(NSIndexPath *)indexPath;
willBegin …被调用一次,而dIDEnd …被调用两次.这有什么理由吗?
我的目标是知道用户何时在单元格上执行了滑动手势,然后取消了取消手势(他不想删除任何内容).这是为了在未执行任何 *** 作的情况下恢复先前选定的单元格(根据UITableView loses selection).
任何提示?
解决方法 我的解决方案在我的博客 Restore the selection of a UITableViewCell after cancelling the “Swipe to delete” operation(2014年12月22日)中有所描述.总而言之,使用一个跟踪 *** 作的布尔值.我开了一个雷达.我将等待回复,我将更新反馈.
func tableVIEw(tableVIEw: UItableVIEw,willBeginEditingRowAtIndexPath indexPath: NSIndexPath) { self.swipeGestureStarted = true}func tableVIEw(tableVIEw: UItableVIEw,dIDEndEditingRowAtIndexPath indexPath: NSIndexPath) { if(self.swipeGestureStarted) { self.swipeGestureStarted = false self.tableVIEw.selectRowAtIndexPath(self.selectedindexPath,animated: true,scrollposition: .None) }}总结
以上是内存溢出为你收集整理的ios – tableView:didEndEditingRowAtIndexPath:委托方法调用两次全部内容,希望文章能够帮你解决ios – tableView:didEndEditingRowAtIndexPath:委托方法调用两次所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)