Commit 48b18c093e2e1b1096fa82640e4d79904575ff46

Authored by zhangxiaowen
1 parent 01bf2cae

no message

CNLiveCollectionModule/Classes/Controller/CNLiveCollectionController.m
... ... @@ -48,7 +48,8 @@ static const CGFloat timeValue = 1.5;
48 48  
49 49 [strongSelf.tableView.mj_header endRefreshing];
50 50 [strongSelf.tableView.mj_footer endRefreshing];
51   -
  51 + strongSelf.isRefreshing = NO;
  52 +
52 53 if (error) {
53 54 [strongSelf.data removeAllObjects];
54 55 [strongSelf.tableView reloadData];
... ... @@ -64,7 +65,6 @@ static const CGFloat timeValue = 1.5;
64 65 if(strongSelf.pageNo == 1 && strongSelf.data.count > 0){
65 66 [strongSelf.data removeAllObjects];
66 67 }
67   - strongSelf.isRefreshing = NO;
68 68 strongSelf.pageNo++;
69 69 [strongSelf.data addObjectsFromArray:array];
70 70 if (array.count < strongSelf.pageSize) {
... ... @@ -205,13 +205,19 @@ static const CGFloat timeValue = 1.5;
205 205 _tableView.estimatedSectionHeaderHeight = 0;
206 206 _tableView.estimatedSectionFooterHeight = 0;
207 207 [_tableView registerClass:[CNLiveCollectionCell class] forCellReuseIdentifier:kCNLiveCollectionCell];
  208 + __weak __typeof(self)weakSelf = self;
208 209 _tableView.mj_header = [CNLiveRefreshHeader headerWithRefreshingBlock:^{
209   - self.pageNo = 1;
210   - [self loadData];
  210 + __strong typeof(weakSelf) strongSelf = weakSelf;
  211 + if(!strongSelf) return ;
  212 + strongSelf.pageNo = 1;
  213 + [strongSelf loadMoreData];
211 214  
212 215 }];
213 216 CNLiveRefreshFooter *footer = [CNLiveRefreshFooter footerWithRefreshingBlock:^{
214   - [self loadMoreData];
  217 + __strong typeof(weakSelf) strongSelf = weakSelf;
  218 + if(!strongSelf) return ;
  219 + [strongSelf loadMoreData];
  220 +
215 221 }];
216 222 footer.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
217 223 _tableView.mj_footer = footer;
... ...