在底部而不是顶部装载工作台

时间:2015-01-12 07:39:13

标签: ios objective-c

我正在尝试将表格加载到滚动视图的底部而不是顶部。我使用了这段代码,但它正在将表格加载到顶部。

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
    float bottomEdge = scrollView.contentOffset.y + scrollView.frame.size.height;
    if (bottomEdge >= scrollView.contentSize.height) {
        if ((isloading = true)) {
            pageno= pageno+1;
            [self fetchdata];
            [self.tableview reloadData];
        }
    }
}

1 个答案:

答案 0 :(得分:0)

UITableView继承自UIScrollView。您可以使用属性contentSize来获取内容的高度,然后您可以使用

- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated

或者,如果你知道哪一行是你的最后一行

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated

Apple Documentation

相关问题