美文网首页
性能优化总结

性能优化总结

作者: KeepFighting | 来源:发表于2016-08-27 22:30 被阅读18次
    1. [UIImage imageWithContentsOfFile:photoFilePath]
      �通过 imageWithContentsOfFile: 加载的图片系统不会缓存;可以通过GCD�加载提高性能,用字典自己缓存
    if(!thumbImage) {
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
          UIImage *image = [UIImage imageWithContentsOfFile:photoFilePath];
            UIGraphicsBeginImageContext(CGSizeMake(180.0f, 120.0f));
            [image drawInRect:CGRectMake(0, 0, 180.0f, 120.0f)];
            thumbImage = UIGraphicsGetImageFromCurrentImageContext();
            UIGraphicsEndImageContext();
          dispatch_async(dispatch_get_main_queue(), ^{
            [self.photosCache setObject:thumbImage forKey:photoName];
            cell.photoView.image = thumbImage;
          });
        });
      }
      
    

    2.关于UIKit优化
    http://www.jianshu.com/p/619cf14640f3

    相关文章

      网友评论

          本文标题:性能优化总结

          本文链接:https://www.haomeiwen.com/subject/gnstettx.html