在UITableView上加载数据向上滚动

时间:2013-11-20 12:02:49

标签: ios uitableview

我想在滚动出UITableView时显示activityindicator并从服务器加载更多内容。

我在几个News Feed应用程序中看到了它:

http://i40.tinypic.com/sf9c0o.png

有谁知道这个,请帮助我,谢谢!

1 个答案:

答案 0 :(得分:0)

使用UIRefreshControl

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"News Feed";
    self.allNewsEntries = [NSMutableArray array];
    [self downloadNewsEntries];

    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl addTarget:self action:@selector(refreshContent)
             forControlEvents:UIControlEventValueChanged];
    self.refreshControl = refreshControl;
}

-(void) refreshContent {
    [self.allNewsEntries removeAllObjects];
    [self downloadNewsEntries];
    [self.refreshControl endRefreshing];
}