在iPhone/iPad中更改UIImage的方向
问题描述:
任何人都可以告诉我如何设置UIImage的方向。这是如果我的UIImage方向是UIImageOrientationDown然后我想要将其更改为UIImageOrientationUp。在iPhone/iPad中更改UIImage的方向
任何人都可以请告诉我如何实现这一点。
我已经搜索了很多,但直到现在我只找到关于如何获得图像的方向。
答
尝试: -
- (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);
}
}
这是UIImage的代表? – Shah 2012-02-20 05:05:19
@sHaH .. Nup .... UIViewController的...它会检测到方向改变事件 – Maulik 2012-02-20 05:22:54
啊...不帮忙的兄弟。 ( – Shah 2012-02-20 05:24:04