UIRefreshControl

UIRefreshControl

平时很少用UIRefreshControl,iOS开发者上手就是MJRefresh 都忘记还有UIRefreshControl这么一个系统提供的控件了。

使用方法

@property (nonatomic, strong) UIRefreshControl *refreshControl;

self.refreshControl = [[UIRefreshControl alloc] init];
[_refreshControl addTarget:self
                    action:@selector(refreshView:)
          forControlEvents:UIControlEventValueChanged];
[self.refreshControl setAttributedTitle:[[NSAttributedString alloc] initWithString:@"更新中..."]];
[self.refreshControl setTintColor:[UIColor lightGrayColor]];
[self.tableView addSubview:self.refreshControl];



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

      [self loadMoreMessage];
    }

 - (void)endRefreshing {
       self.isLoading = NO;
       [self.refreshControl endRefreshing];
    }

你可能感兴趣的:(UIRefreshControl)