iOS UITableView和UITableViewCell滚动和NSTimer计时
来源:互联网 发布:社会与经济统计数据库 编辑:程序博客网 时间:2024/05/21 10:43
UITableViewCell上有个UILabel,显示NSTimer实现的秒表时间,手指滚动UITableViewCell的过程中,label是否刷新。
这是否刷新取决于timer加入到Run Loop中得Mode是什么,Mode主要是用来指定事件在运行循环中得优先级,有:
1、NSDefaultRunLoopMode(KCFRunLoopDefaultMode) -> 默认
2、UITrackingRunLoopMode:ScrollView滑动时会切换到该Mode
3、UIInitializationRunLoopMode -> Run Loop启动时,会切换到该Mode
4、NSRunLoopCommonModes(KCFRunLoopCommonModes) -> Mode集合
苹果公开的Mode有两个:
NSDefaultRunLoopMode(KCFRunLoopDefaultMode)和NSRunLoopCommonModes(KCFRunLoopCommonModes)
在编程中如果我们把一个NSTimer对象以NSDefaultRunLoopMode(KCFRunLoopDefaultMode)添加到主运行循环中,ScrollView滚动过程中会因为Mode的切换,而导致NSTimer将不再被调度。当我们滚动的时候,也希望不调度,那就应该使用默认模式。但是,如果我们希望ScrollView在滚动时,计时器也要回调,那就应该使用NSRunLoopCommonModes(KCFRunLoopCommonModes)。
在NSTimer方法中千万不要做耗时操作,不然NSTimer和UI都是一样的RunLoop优先级,会造成UI卡顿。
- iOS UITableView和UITableViewCell滚动和NSTimer计时
- UITableView和UITableViewcell
- UITableView和UITableViewCell 图解
- UITableView和UITableViewCell
- IOS开发中UITableView和UITableViewCell的几种样式
- iOS开发中UITableView和UITableViewCell的几种样式
- IOS开发中UITableView和UITableViewCell的几种样式
- IOS开发中UITableView和UITableViewCell的几种样式
- IOS开发中UITableView和UITableViewCell的几种样式
- UITableView和UITableViewCell在iOS不同版本中的结构差异
- IOS开发中UITableView和UITableViewCell的几种样式
- iOS开发中UITableView和UItableViewCell的几种形式
- iOS开发中UITableView和UITableViewCell的几种样式
- iOS开发中UITableView和UITableViewCell的几种样式
- iOS开发中UITableView和UITableViewCell的几种样式
- 结合android ,讲述iOS UITableView和UITableViewCell的用法
- iOS开发中UITableView和UITableViewCell的几种样式
- swift UItableView和自定义uitableViewCell
- linux常见指令与权限管理
- C语言中的const,volatile,restrict用法总结
- Kettle学习之路(3)理解一些基本概念
- 初识高德地图和百度地图
- 软件分析 加密狗复制 vidi深度学习软件
- iOS UITableView和UITableViewCell滚动和NSTimer计时
- 网址短连接 short url
- mongodb(二)-- mongodb shell及基本操作
- HTTP 以及 Ajax学习整理
- Java 中 Vector 、 Stack 、 CopyOnWriteArrayList 的实现解析
- android反编译与加固(Mac版)
- 初学者容易犯的错误,SQL中的基本操作问题(mysql)二
- (OK) 移植,编译,安装 LineageOS-14.1-kiwi (Android-7.1.1,运行在Huawei honor 5x) for VirtualBox
- 安卓 呼吸灯效果--代码实现