iosiOS_UIKit

UIRefreshControl

2018-05-14  本文已影响1人  絮语时光杨

UIRefreshControl是iOS6自带的UITableView下拉刷新控件。

@property (nonatomic, readonly, getter=isRefreshing) BOOL refreshing;

@property (null_resettable, nonatomic, strong) UIColor *tintColor;
@property (nullable, nonatomic, strong) NSAttributedString *attributedTitle UI_APPEARANCE_SELECTOR;

// May be used to indicate to the refreshControl that an external event has initiated the refresh action

// UITableView
_tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
[_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"];
[self.view addSubview:_tableView];

// UIRefreshControl  
_refreshControl = [[UIRefreshControl alloc] init];  
_refreshControl.tintColor = [UIColor redColor];  
_refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"下拉刷新"];  
[_refreshControl addTarget:self action:@selector(refreshControlAction) forControlEvents:UIControlEventValueChanged];  
[_tableView addSubview:_refreshControl]; 
上一篇 下一篇

猜你喜欢

热点阅读