佚名通过本文主要向大家介绍了ios uiimage,ios uiimage 转byte,uiimage,uiimage imagenamed,uiimage 四个角拉伸等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: iOS开发 想旋转UIImage90度 但是毫无效果
描述:
解决方案1:
描述:
用这个方法[UIImage imageWithCGImage:img.CGImage scale:2.0 orientation:UIImageOrientationRight]
想旋转UIImage90度 但是毫无效果
解决方案1:
下面的代码可以正确旋转图片。
UIImage *img = [UIImage imageNamed:@"i"];
UIImageOrientation a0 = img.imageOrientation;
UIImage *image = [UIImage imageWithCGImage:img.CGImage scale:2.0 orientation:UIImageOrientationRight];
UIImageOrientation a2 = image.imageOrientation;
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[imageView sizeToFit];
[self.view addSubview:imageView];
解决方案2:你那个原图片 img 的 orientation 是什么?我猜可能本来就是 right,所以重新建一个 orientation 是 right 的 UIImage 是没有任何变化的。
你需要先修正一下原图片的方向:https://gist.github.com/alex-cellcity/1531596