美文网首页
UIRefreshControl

UIRefreshControl

作者: 独木舟的木 | 来源:发表于2018-12-28 15:10 被阅读4次

UIRefreshControl

示例代码

@implementation MyViewController
{
    UIRefreshControl * refreshControl;
}

- (void)viewDidLoad {
    [super viewDidLoad];
        
    // 刷新控件
    refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl addTarget:self action:@selector(refreshCallback) forControlEvents:UIControlEventValueChanged];
    [self.tableView addSubview:refreshControl];
    
    [self prepareDemoData];
}

#pragma mark - IBActions

// 刷新控件触发方法
-(void) refreshCallback
{
    // Run job...
    [_tableView reloadData];
    [refreshControl endRefreshing];
}

推荐阅读

相关文章

网友评论

      本文标题:UIRefreshControl

      本文链接:https://www.haomeiwen.com/subject/snirlqtx.html