ios图片截取

来源:互联网 发布:中国地缘政治知乎 编辑:程序博客网 时间:2024/05/18 12:38
  1. - (UIImage *)clipImage:(UIImage *)image imageoritation:(UIImageOrientation)oritation withRect:(CGRect)rect  
  2. {  
  3.     CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], rect);  
  4.     UIImage *clipImage = [UIImage imageWithCGImage:imageRef scale:image.scale orientation:oritation];//UIImageOrientationLeft  
  5.     CGImageRelease(imageRef);  
  6.     return clipImage; 
  7. }  
0 0