系统默认的刷新方法(UIRefreshControl)

系统默认的刷新方法(下拉)

@property (nonatomic, retain) UIRefreshControl *control;

- (void)viewDidLoad {

    [super viewDidLoad];

    

    //系统默认的刷新(下拉)

   self.control = [[UIRefreshControl alloc] init];

    self.control.attributedTitle = [[NSAttributedString alloc] initWithString:@"正在加载数据..."];

    [self.view addSubview:self.control];

    [_control release];

    

    [self.control addTarget:self action:@selector(changeValue:) forControlEvents:UIControlEventValueChanged];

}

- (void)changeValue:(UIRefreshControl *)control {

    [self.control endRefreshing]; // 关闭刷新效果

    

    [self.nameList addObject:@"someOne"];

    [self.tableView reloadData];

}

猜你喜欢

转载自blog.csdn.net/Michael_234198652/article/details/50809076
今日推荐