iOS 開發中類似上下滾動彈幕實現原理
阿新 • • 發佈:2018-01-22
tarray void ddr 列表 fse post mar ati poi
#mark ---滾動彈幕 列表中留有7條記錄 大於7條時刪除並指引表視圖向上滑動
- (void)addRowActionWithContent:(NSString *)str {
if (self.dataMutArray.count > 7) {
[self.dataMutArray removeLastObject];
[self.resultTableView deleteSections:[NSIndexSet indexSetWithIndex:self.dataMutArray.count - 1] withRowAnimation:(UITableViewRowAnimationNone)];
}
[self.dataMutArray insertObject:str atIndex:0];
[self.resultTableView insertSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationTop];
[self.resultTableView setContentOffset:CGPointMake(0,0) animated:YES];
}
iOS 開發中類似上下滾動彈幕實現原理