-(void)zzRefresh { // 自行创建下拉动画 [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; self.main_tableView.contentOffset = CGPointMake(0.0, -50.0); // 注意位移点的y值为负值 [UIView commitAnimations]; // 改变refreshControl的状态 [self.refreshControl beginRefreshing]; self.refreshControl.attributedTitle = [[NSAttributedString alloc]init]; // 刷新数据和表格视图 [self performSelector:@selector(RefreshViewControl) withObject:nil afterDelay:0.7]; }
@property (strong, nonatomic) UIRefreshControl *refreshControl;
-(void)InitRefreshControl { self.refreshControl = [[UIRefreshControl alloc]init]; [self.refreshControl addTarget:self action:@selector(touchRefresh) forControlEvents:UIControlEventValueChanged]; [self.m_table addSubview:self.refreshControl]; }