一个定时器NSTimer 定时执行下面的代码
self.cellIndex=0;
self.timer= [NSTimerscheduledTimerWithTimeInterval:timeAftertarget:selfselector:@selector(addCell)userInfo:nilrepeats:YES];
#pragma mark ---动态添加cell---
- (void)addCell{
[self.dataArrayaddObject:self.dataArray1[self.cellIndex]];
NSIndexPath*indexPath = [NSIndexPathindexPathForRow:self.cellIndexinSection:0];
//插入
[self.tableViewinsertRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationFade];
//滚动
[self.tableViewscrollToRowAtIndexPath:[NSIndexPathindexPathForRow:self.cellIndex
inSection:0]
atScrollPosition:UITableViewScrollPositionTop
animated:YES];
self.cellIndex++;
}