国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > iOS > 正文

iOS UIRefreshControl

2019-11-09 16:05:42
字體:
供稿:網(wǎng)友
#import "RefreshViewController.h"@interface RefreshViewController ()<UITableViewDelegate,UITableViewDataSource>@PRoperty (nonatomic, strong) UITableView *tableView;@property (nonatomic, strong) UIRefreshControl *refreshControl;@end@implementation RefreshViewController- (void)viewDidLoad { [super viewDidLoad]; _tableView = [[UITableView alloc] initWithFrame:self.view.bounds]; _tableView.delegate = self; _tableView.dataSource = self; [self.view addSubview:_tableView]; [self createRefreshControl];}- (void)createRefreshControl{ if (_refreshControl == nil) { _refreshControl = [[UIRefreshControl alloc] init]; [_refreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged]; [self.tableView addSubview:_refreshControl]; } //默認(rèn)進(jìn)入刷新狀態(tài) [self refresh]; _tableView.contentOffset = CGPointMake(0, -60);}- (void)refresh{ [_refreshControl beginRefreshing]; [self performSelector:@selector(endRefresh) withObject:nil afterDelay:3.0f];}- (void)endRefresh{ [_refreshControl endRefreshing]; _tableView.contentOffset = CGPointMake(0, 0);}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 10;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; } cell.textLabel.text = @"測(cè)試數(shù)據(jù)"; return cell;}@end

這里寫圖片描述


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: SHOW| 彰化县| 三台县| 长海县| 武陟县| 维西| 海晏县| 蓬安县| 大同市| 阿勒泰市| 西贡区| 新竹县| 开阳县| 乌鲁木齐县| 讷河市| 台江县| 儋州市| 东乡县| 平阴县| 宜君县| 揭东县| 临漳县| 柳州市| 临夏县| 全椒县| 道孚县| 门源| 泾川县| 宜兰市| 罗平县| 太保市| 延边| 腾冲县| 两当县| 东莞市| 西盟| 石嘴山市| 新安县| 灵寿县| 洪泽县| 牡丹江市|