iOS 开发中类似上下滚动弹幕实现原理

#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];

}

 

posted @ 2018-01-22 16:24  tryFighting  阅读(1461)  评论(0编辑  收藏  举报