gpt4 book ai didi

objective-c - 当 UITableview 的部分滚动到顶部时如何获得通知?

转载 作者:行者123 更新时间:2023-11-28 23:05:00 25 4
gpt4 key购买 nike

我有一个包含许多部分的 UITableView,每个部分只有一个单元格。

我想在某个部分滚动到顶部(某个部分将消失)并执行某些操作时收到通知。

如何获取通知?

最佳答案

您应该在委托(delegate)方法中尝试类似以下的操作:

- (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...
}

如果我没理解错的话,这应该就是您所需要的。

关于objective-c - 当 UITableview 的部分滚动到顶部时如何获得通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9479036/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com