IOS学习之——向cell表格里面填数据
2016-04-20 19:47
591 查看
向表格中增加数据
方式一
: reloadData 刷新 tableView
方式二
: insertRowsAtIndexPath 只更新一部分
注意:没有多线程是
第二种方式性能低
方式一
: reloadData 刷新 tableView
方式二
: insertRowsAtIndexPath 只更新一部分
注意:没有多线程是
第二种方式性能低
//添加城市数据 City *city = [[City alloc]init]; city.name = @"深圳"; city.population = 3400; //应该把城市对象 添加到 城市对象数组中 [self.allcities addObject:city]; //方式一 // //刷新 整个 tableView // [self.tableView reloadData]; //方式二 //刷新 最后一行 保证要插入的数据已经插入到数据数组中 NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:self.allcities.count - 1 inSection:0]; [self.tableView insertRowsAtIndexPaths:@[newIndexPath] withRowAnimation:UITableViewRowAnimationLeft];
相关文章推荐
- IOS开发中的多线程&&多任务的管理设计简单示例
- IOS学习之——Cell自定义内容视图&自定义辅助视图
- IOS封装Framework,使用bundle管理资源(二)
- iOS修改导航栏字体颜色
- iOS开发工具篇—Xcode的一些使用技巧
- IOS消息推送之APNS
- iOS 类别和扩展(Categories和Extensions)
- iOS中事件传递 及手势操作
- iOS开发--"Library not found for -"错误处理
- iOS代理设计模式
- iOS每日一记-----如何写好简历 。。。。
- iOS修改系统音量
- ios开发时,在Xcode中添加多个targets进行版本控制
- iOS获取本机号码
- 两个iOS 应用间的相互跳转
- 公司用到的一些 iOS 开源库和第三方组件
- 在iOS9 中使用3D Touch
- ios ALAssetsLibrary简单的使用
- ios本地数据持久化方法
- iOS cocoapods 使用以及版本更新