#import<MJRefreshNormalHeader.h>
- (void)example03
{
// 设置回调(一旦进入刷新状态,就调用target的action,也就是调用self的loadNewData方法)
header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
// 设置自动切换透明度(在导航栏下面自动隐藏)
header.automaticallyChangeAlpha = YES;
// 隐藏时间
header.lastUpdatedTimeLabel.hidden = NO;
// 马上进入刷新状态
[header beginRefreshing];
// 设置header
_table.mj_header = header;
}
-(void)loadNewData{
bookmessage *mess = [[bookmessage alloc]init];
mess.bookname = @"海底两万里";
mess.zuozhe = @"me";
mess.price = @"20";
[array addObject:mess];
//[[DataBase initDataBase]AddData:mess];
[[DataBase initDataBase]addData:mess];
[_table reloadData];
[header endRefreshing];
}
网友评论