對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數量一多,機型更破 優化的效果會更明顯</pre>
Requirements
- iOS 5.0+
- ARC only </ul>
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.baiduhome.net/lib/view/home/1449730218379</p> </strong>
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!