现在的位置: 首页 > 综合 > 正文

UIRefreshControl代码刷新

2018年02月02日 ⁄ 综合 ⁄ 共 702字 ⁄ 字号 评论关闭
-(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];
}
【上篇】
【下篇】

抱歉!评论已关闭.