Pull to Refresh (ios)

前端 未结 8 1040
清酒与你
清酒与你 2020-12-07 22:08

I recently implemented pull to refresh here: https://github.com/leah/PullToRefresh. It kind of works however it gets stuck with a spinning activity indicator. Their is also

相关标签:
8条回答
  • 2020-12-07 22:50

    Now, with newer versions of iOS than the above stated iOS 5 you can use: UIRefreshControl.

    There is a really good tutorial on creating your own custom pull to refresh for your iOS Application: http://ios-blog.co.uk/tutorials/how-to-add-a-custom-pull-to-refresh-in-your-ios-application/

    0 讨论(0)
  • 2020-12-07 22:52

    Apple has introduced UIRefreshControl in iOS6. You can integrate it in your UITableViewController using

    - (void)viewDidLoad {
        [super viewDidLoad];
        // Initialize Refresh Control
        UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
        // Configure Refresh Control
        [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
        // Configure View Controller
        [self setRefreshControl:refreshControl];
    }
    

    the refresh: method will trigger the update and you can stop it in your API callback using:

     [(UIRefreshControl *)sender endRefreshing];
    
    0 讨论(0)
提交回复
热议问题