Skip to content

Instantly share code, notes, and snippets.

@chiahsien
Created October 30, 2012 14:46
Show Gist options
  • Save chiahsien/3980627 to your computer and use it in GitHub Desktop.
Save chiahsien/3980627 to your computer and use it in GitHub Desktop.
UITableView 滾到底時載入更多
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
// 或許你會有一個變數來判斷目前是否正在載入資料
if (isLoading)
return;
// 判斷滾到哪裡的時候要自動載入更多,這可以依需求調整
if ((scrollView.contentOffset.y > scrollView.contentSize.height - scrollView.frame.size.height * 2) &&
// 或許你會有其他辦法來判斷是否還有更多資料可以載入
(currentPage < pageCount))
{
// 載入更多的動作寫在這裡
[self loadNextPage];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment