用UITableViewDelegate中的這個方法:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
判定tableView中的數組數是否即將顯示最後一個cell,if (indexPath.row == [self.dataArr count]-1)
想在下邊加個視圖的話,可以這麼做:
在UITableView中的tableFooterView裏
self.tableView.tableFooterView = footSpinnerView;//footSpinnerView爲自定義的UIView,上面加了一個旋轉的 UIActivityIndicatorView即可,記得讓UIActivityIndicatorView startAnimation
加上你關於刷新數組的邏輯,如從數據庫中取出更多的數據,取完數據後,將self.tableView.tableFooterView設nil即可。