刷新屏幕Cell 的一些方法

简介: 刷新屏幕Cell 的一些方法

##

-重新刷新屏幕上的所有cell

```objc

[self.tableView reloadData];

```

-刷新特定行的cell

```objc

[self.tableView reloadRowsAtIndexPaths:@[

[NSIndexPath indexPathForRow:0 inSection:0],

[NSIndexPath indexPathForRow:1 inSection:0]

]

withRowAnimation:UITableViewRowAnimationLeft];

```

-插入特定行数的cell

```objc

[self.tableView insertRowsAtIndexPaths:@[

[NSIndexPath indexPathForRow:0 inSection:0],

[NSIndexPath indexPathForRow:1 inSection:0]

]

withRowAnimation:UITableViewRowAnimationLeft];

```

-删除特定行数的cell

```objc

[self.tableView deleteRowsAtIndexPaths:@[

[NSIndexPath indexPathForRow:0 inSection:0],

[NSIndexPath indexPathForRow:1 inSection:0]

]

withRowAnimation:UITableViewRowAnimationLeft];

```

##数据刷新的原则

-通过修改模型数据,来修改tableView的展示

-先修改模型数据

-再调用数据刷新方法

-不要直接修改cell上面子控件的属性


相关文章
|
1月前
|
Python
update_frame 图象刷新
update_frame 图象刷新
12 4
|
4月前
datables之加载数据时显示进度条
datables之加载数据时显示进度条
53 0
|
前端开发 Android开发
Android SurfaceView 绘图覆盖刷新及“.NET研究”脏矩形刷新方法
  SurfaceView在Android中用作游戏开发是最适宜的,本文就将演示游戏开发中常用的两种绘图刷新策略在SurfaceView中的实现方法。   首先我们来看一下本例需要用到的两个素材图片:   bj.jpg就是一个渐变图,用作背景。
1218 0
|
开发者
解决 Popup 位置不随窗口移动更新的问题
原文:解决 Popup 位置不随窗口移动更新的问题 Popup弹出后,因业务需求设置了StaysOpen=true后,移动窗口位置或者改变窗口大小,Popup的位置不会更新。 如何更新位置? 获取当前Popup的Target绑定UserControl所在窗口,位置刷新时,时时更新Popup的位置即可。
1025 0
tableView 去掉底部多余的cell线(记录备忘)
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
790 0