UIRefreshControl iOS 6 xcode

前端 未结 3 1434
一个人的身影
一个人的身影 2020-12-12 22:32

Does anyone have a short example of how to implement the new UIRefreshControl into xcode. I have a UITableViewController which displays Tweets, wa

3条回答
  •  既然无缘
    2020-12-12 22:51

    You can just set it up in your viewDidLoad, if you have a UITableViewController:

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

    Then you can do your refresh stuff here:

    -(void)refresh {
        // do something here to refresh.
    }
    

    When you are done with refreshing, call [self.refreshControl endRefreshing]; to stop the refresh control, as pointed out by rjgonzo.

提交回复
热议问题