UIImage

1.  加载图片时: imageNamed 和 imageWithContentsOfFiled 的区别 

  用imageName加载图片时候会图片占用内存空间,用imageWithContententsOfFile加载图片的时候图片不会占用内存

  当加载大量图片的时候建议使用imageViewContentsOfFile

2. 得到一张可拉伸的图片

   UIImage *strechableImage = [image stretchableImageWithLeftCapWidth:image.size.width * 0.5

                                 topCapHeight:image.size.height *0.5];

 

保存图片到本地

#pragma mark - 保存图片

- (void)saveImageToPhotos:(UIImage *)savedImage {

    UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);

}

 

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {

    NSString *msg = nil;

 

    if (error != NULL) {

        msg = @"保存图片失败";

    } else {

        msg = @"保存图片成功";

    }

  //提示msg

}

posted on 2015-10-16 11:58  AN_绝非儿戏  阅读(108)  评论(0)    收藏  举报

导航