【问题标题】:UITableView/UIScrollView scrollToItemAtIndexUITableView/UIScrollView scrollToItemAtIndex
【发布时间】:2010-06-20 13:05:04
【问题描述】:

我正在打电话

[tableView scrollToItemAtIndex: [tableView indexForCell: firstVisibleCell] atScrollPosition: UITableViewScrollPositionTop animated:YES];

强制我的表格“捕捉”到第一个可见项目。这工作正常,但我只接到一个电话

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView

何时必须完成滚动(文档中已说明)。无论如何我可以获得 firstVisibleCell 的偏移量,以便我可以进行比较以查看是否需要滚动?

【问题讨论】:

    标签: iphone uiscrollviewdelegate


    【解决方案1】:

    使用方法- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath

    NSIndexPath *indexPath = [tableView indexForCell:firstVisibleCell];
    CGRect rect = [tableView rectForRowAtIndexPath:indexPath];
    

    【讨论】:

    • 正是我想要的。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-11
    • 2023-03-25
    • 1970-01-01
    • 1970-01-01
    • 2014-09-16
    • 2020-03-09
    相关资源
    最近更新 更多