IOS development: the positions of the tableview are disordered and the offset is returned to the original position, iostableview
Why is the data location disordered when I pull it up and refresh it? Is the table view offset incorrect? For example, a total of 40 data records and 20 data records are loaded at a time. Normally, 21st data records are displayed. After loading the data, we find that the tableview stops at 11th or 30 data records, if you are experiencing the same situation as me
-(Void) addRefresh {__ weak typeof (self) weakSelf = self; weakSelf. nomalTable. mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock: ^ {weakSelf. page = @ "0"; [weakSelf tableReloadCtrlWithPage] ;}]; weakSelf. nomalTable. mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock: ^ {NSInteger index = [self. page intValue]; index + = 1; weakSelf. page = [NSString stringWithFormat: @ "% ld", (long) inde X]; [weakSelf tableReloadCtrlWithPage] ;}]; [weakSelf. nomalTable. mj_header beginRefreshing];} // the page here refers to the page number. // when it is set to if page = 1 else page + = 1-(void) tableReloadCtrlWithPage {[self. nomalTable reloadData]; if (! Self. dataArr. count? YES: NO) {self. nomalTable. tableFooterView = [self getTableFootView: self. nomalTable. bounds str: @ "nodata"];} else {self. nomalTable. tableFooterView = [UIView new];} NSInteger oldCnt = [self. dataArr count]; if (oldCnt> 0 & [self. page intValue]! = 0) {NSInteger row = oldCnt-20; NSIndexPath * indexPath = [NSIndexPath indexPathForRow: row inSection: 0]; [self. nomalTable scrollToRowAtIndexPath: indexPath atScrollPosition: UITableViewScrollPositionBottom animated: NO] ;}}