本文介绍了我如何知道一个UITableView是否包含一个特定的NSIndexPath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里是我使用的代码:
if (appDelegate.currentMainIndexPath != nil /* && doesPathExistInTableView */) { [tblView scrollToRowAtIndexPath:appDelegate.currentMainIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO]; appDelegate.currentMainIndexPath = nil; }推荐答案
code> UITableViewCell 由:
You could try to get UITableViewCell by :
- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath; // returns nil if cell is not visible or index path is out of range完整的代码:
UITableViewCell *cell = [cellForRowAtIndexPath:appDelegate.currentMainIndexPath]; if (appDelegate.currentMainIndexPath != nil && cell !=nil) { [tblView scrollToRowAtIndexPath:appDelegate.currentMainIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO]; appDelegate.currentMainIndexPath = nil; }更多推荐
我如何知道一个UITableView是否包含一个特定的NSIndexPath?
发布评论