【发布时间】:2012-02-20 04:15:27
【问题描述】:
任何人都可以告诉我如何设置我的 UIImage 的方向。也就是说,如果我的 UIImage 方向是 UIImageOrientationDown 那么我想将其更改为 UIImageOrientationUp。
谁能告诉我如何做到这一点。
我已经搜索了很多,但到目前为止,我只发现了有关如何获取图像方向的信息。
【问题讨论】:
标签: iphone ipad uiimage orientation
任何人都可以告诉我如何设置我的 UIImage 的方向。也就是说,如果我的 UIImage 方向是 UIImageOrientationDown 那么我想将其更改为 UIImageOrientationUp。
谁能告诉我如何做到这一点。
我已经搜索了很多,但到目前为止,我只发现了有关如何获取图像方向的信息。
【问题讨论】:
标签: iphone ipad uiimage orientation
尝试:-
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
yourImage.transform = CGAffineTransformMakeRotation(M_PI / 2);
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight){
yourImage.transform = CGAffineTransformMakeRotation(-M_PI / 2);
}
else {
yourImage.transform = CGAffineTransformMakeRotation(0.0);
}
}
【讨论】: