对View进行缓存 预加载UIView,提高界面切换速度
IMYViewCache
对View进行缓存 预加载UIView,提高界面切换速度。 支持全局UITableViewCell复用
使用 5s 测试 no_cache 加载时间:0.002630 no_cache 加载时间:0.001345 no_cache 加载时间:0.001508 cache 加载时间:0.000082 cache 加载时间:0.000048 cache 加载时间:0.000042 差不多会差10倍 4s 测试 no_cache 加载时间:0.007064 no_cache 加载时间:0.006878 no_cache 加载时间:0.006625 cache 加载时间:0.000315 cache 加载时间:0.000338 cache 加载时间:0.000314 虽然 0.001 的单位。 肉眼是感觉不出来的 但是如果界面一旦复杂起来,cell数量一多,机型更破 优化的效果会更明显
Requirements
- iOS 5.0+
- ARC only
Adding to your project
pod 'IMYViewCache', :head
Basic usage
1 . useIMYViewCacheManagerregister view class
+(void)load { [UITableView imy_registerClass:[IMYEBBrandSingleCell class] nib:[UINib nibWithNibName:@"IMYEBBrandSingleCell" bundle:nil] reuseIdentifier:@"IMYEBBrandSingleCell" cacheCount:8]; } and UITableView *tableView = [new]; ... tableView.imy_usingViewCache = YES;
2 . replace view initialization method
IMYEBBrandSingleCell* cell = [tableView dequeueReusableCellWithIdentifier:@"IMYEBBrandSingleCell"];
3 . OK
项目主页:http://www.open-open.com/lib/view/home/1449730218379</p> </strong>
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!