iOS图片优化加载本地图片

          UIImageView *imageV = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];;
            //低效
            imageV.image = [UIImage imageNamed:@"图片.png"];
            
            //高效
            NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
            NSString *filePath = [resourcePath stringByAppendingPathComponent:@"图片.png"];
            UIImage *image = [UIImage imageWithContentsOfFile:filePath];
            imageV.image = image;
            
            [self.view addSubview:imageV];

转载于:https://www.jianshu.com/p/aeb6d7f48a6e

猜你喜欢

转载自blog.csdn.net/weixin_33922670/article/details/91063249