MJRefresh的简单使用

-(void)history_addRefresh{

    //下拉

    MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{

        // 进入刷新状态后会自动调用这个block

    }];

    // 设置回调(一旦进入刷新状态,就调用target的action,也就是调用self的headerRereshing方法)

    header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRereshing)];

    // 隐藏时间

    header.lastUpdatedTimeLabel.hidden = YES;


    // 设置文字

    [headersetTitle:@"上个月" forState:MJRefreshStateIdle];

    [headersetTitle:@"上个月" forState:MJRefreshStatePulling];

    [headersetTitle:@"上个月" forState:MJRefreshStateRefreshing];

    // 设置字体

    header.stateLabel.font = [UIFont systemFontOfSize:16];

    header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:16];

    // 设置颜色

    header.stateLabel.textColor = [UIColor blackColor];

    header.lastUpdatedTimeLabel.textColor = [UIColor blueColor];

    self.gative_Table.mj_header = header;

//    MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];

    //上拉

    MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{

        // 进入刷新状态后会自动调用这个block

    }];

    // 设置回调(一旦进入刷新状态,就调用target的action,也就是调用self的loadMoreData方法)

    footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRereshing)];

    // 设置文字

    [footersetTitle:@"下个月" forState:MJRefreshStateIdle];

    [footersetTitle:@"下个月" forState:MJRefreshStateRefreshing];

    [footersetTitle:@"下个月" forState:MJRefreshStateNoMoreData];


    // 设置字体

    footer.stateLabel.font = [UIFont systemFontOfSize:16];


    // 设置颜色

    footer.stateLabel.textColor = [UIColor blackColor];

    // 设置尾部

    self.gative_Table.mj_footer = footer;

}

-(void)headerRereshing{

[self.gative_Table.mj_header endRefreshing];

}

-(void)footerRereshing{

[self.gative_Table.mj_header endRefreshing];

}

你可能感兴趣的:(MJRefresh的简单使用)