iOS swift lazy loading
2016-01-30 18:14
405 查看
Why bother lazy loading and purging pages, you ask?
Well, in this example, it won’t matter too much if you load all the pages at the start, since there are only five and they won’t be large enough to eat up too much memory. But imagine you had 100 pages and each image was 5MB in size. That would take up 500MB of memory if you loaded all the pages at once! Your app would quickly exceed the amount of memory available and be killed by the operating system. Lazy loading means that you’ll only have a certain number of pages in memory at any given time.
Well, in this example, it won’t matter too much if you load all the pages at the start, since there are only five and they won’t be large enough to eat up too much memory. But imagine you had 100 pages and each image was 5MB in size. That would take up 500MB of memory if you loaded all the pages at once! Your app would quickly exceed the amount of memory available and be killed by the operating system. Lazy loading means that you’ll only have a certain number of pages in memory at any given time.
相关文章推荐
- 论Swift开发入门:滑块(UISlider)
- swift5分钟语法速记
- Swift:用UICollectionView整一个瀑布流
- Swift:用UICollectionView整一个瀑布流
- 8.Swift 中的控制转移语句
- swift-数组array
- Ubuntu Make 新版上线:支持安装 Swift 编程语言
- Swift继承
- Swift方法
- Swift类和结构体
- swift算法手记-7
- Swift 基本知识之十九 swift懒加载(lazy修饰符)
- Swift 基本知识之十八 swift格式化输出和反射机制
- Swift中NSData与NSDictionary之间的相互转换
- Swift 基本知识之十七 swift遍历数组的几种方式
- Swift 基本知识之十六 swift与C 混编的两种方式
- Swift 基本知识之十五 swift编码
- Swift 基本知识之十四 Sizeof 和 sizeofValue 解析
- Swift 基本知识之十三 构造函数
- 思考 Swift 中的 MirrorType 协议