iPhone Dev

UIRefreshControl 사용법

떡공이 2016. 6. 30. 17:09

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];

[refreshControl addTarget:self action:@selector(listRefresh:) forControlEvents:UIControlEventValueChanged];

[listview addSubview:refreshControl];


- (void) listRefresh:(UIRefreshControl *)refreshControl{

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

        [self getList];

        dispatch_async(dispatch_get_main_queue(), ^{

            [refreshControl endRefreshing];

        });

    });

}