Pull to Refresh (ios)

前端 未结 8 1062
清酒与你
清酒与你 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: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];
    

提交回复
热议问题