我有一个包含许多部分的UITableView,每个部分只有一个单元格。
我想在部分滚动到顶部(一个部分将消失)并执行某些操作时收到通知。
如何获取通知?
答案 0 :(得分:2)
您应该在委托方法中尝试以下内容:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
CGRect rect = [tableView rectForRowAtIndexPath:indexPath];
float ypos = rect.origin.y;
if(y==<your identifier for top>) {
NSLog(@"I am on top");
}
// rest of your code...
}
如果我理解正确,这应该是你需要的。
答案 1 :(得分:0)
鉴于UITableViewDelegate符合UIScrollViewDelegate,您所要做的就是响应此方法:
- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView