Ios InsertRowsAtIndexPaths,在[\u mainTableView endUpdates]处中断,但如果删除BeginUpdate和endUpdates,将在SDAutoLayout中中断
[UIView animateWithDuration:0.2f动画:^{Ios InsertRowsAtIndexPaths,在[\u mainTableView endUpdates]处中断,但如果删除BeginUpdate和endUpdates,将在SDAutoLayout中中断,ios,insert,tableview,Ios,Insert,Tableview,[UIView animateWithDuration:0.2f动画:^{ NSMutableArray *indexPaths = [[NSMutableArray alloc] init] ; [_dataArray addObject:@"loading"]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [indexPaths addObjec
NSMutableArray *indexPaths = [[NSMutableArray alloc] init] ;
[_dataArray addObject:@"loading"];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[indexPaths addObject: indexPath];
[_mainTableView beginUpdates];
[_mainTableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
[_mainTableView endUpdates];
} completion:^(BOOL finished) {
// [_mainTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:_dataArray.count - 1 inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
}];
pragma标记-UITableViewDelegate,UITableViewDataSource
将打断sdautolayout:UITableView+SDAutoTableViewCellHeight.h-(void)sd_InsertRowsAndExpaths:(NSArray*)带RowAnimation的indexPaths:(UITableViewRowAnimation)animation{[self.cellAutoHeightManager insertNewDataAtIndexPaths:indexPaths];[self-sd_insertRowsAtIndexPaths:indexPaths with row animation:animation];}将在sdautolayout:UITableView+SDAutoTableViewCellHeight.h-(void)sd_insertRowsAtIndexPaths:(NSArray*)indexPaths with row animation:(uitableviewanimation)动画{[self.cellAutoHeightManager InsertNewDataAtIndexPath:IndexPath];[self-sd_insertRowsAtIndexPaths:IndexPath with RowAnimation:animation];}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:
(NSInteger)section
{
return _dataArray.count;
}