您的位置:首页 > 其它

tableView的使用(二)当前tableView视图中添加一行cell

2014-08-18 15:12 471 查看
当你点击一个按钮触发addCell事件

-(void)addCell:(id)sender

{

[self.thirdTableView beginUpdates]; //告诉tableView将要开始更新

[delegate.mArray addObject:@"New Cell"]; //更新数据源

NSIndexPath *indexPathOfNewItem = [NSIndexPath indexPathForItem:delegate.mArray.count-1 inSection:0];

[self.thirdTableView insertRowsAtIndexPaths:@[indexPathOfNewItem] withRowAnimation:UITableViewRowAnimationAutomatic];

[self.thirdTableView endUpdates];

[self.thirdTableView scrollToRowAtIndexPath:indexPathOfNewItem atScrollPosition:UITableViewScrollPositionBottom animated:YES];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐