10
检查UITableViewCell是否完全可见的最佳方法
我有一个带有不同高度的单元格的UITableView,我需要知道它们何时完全可见。 现在,我遍历可见单元列表中的每个单元,以检查每次滚动视图时是否完全可见。这是最好的方法吗? 这是我的代码: - (void)scrollViewDidScroll:(UIScrollView *)aScrollView { CGPoint offset = aScrollView.contentOffset; CGRect bounds = aScrollView.bounds; NSArray* cells = myTableView.visibleCells; for (MyCustomUITableViewCell* cell in cells) { if (cell.frame.origin.y > offset.y && cell.frame.origin.y + cell.frame.size.height < offset.y + bounds.size.height) { [cell notifyCompletelyVisible]; } else { [cell notifyNotCompletelyVisible]; } } } 编辑: 请注意,*-(NSArray …
100
ios
uitableview
visible