2013-11-20 81 views
-4

我想顯示activityindicator並在滾動出UITableView時從服務器加載更多內容。在UITableView上加載數據滾動

我看到它在幾個新聞飼料應用:

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

有誰知道這一點,請幫幫我,謝謝!

+0

這就是所謂的'UIRefreshControl' –

回答

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]; 
} 
相關問題