【发布时间】:2011-02-03 05:27:09
【问题描述】:
我有一个带有 4 个子视图的视图。
我的应用程序将同时支持描绘和横向模式。
4个子视图中,有一个视图只支持描绘。
我该怎么做。
提前谢谢你。
【问题讨论】:
标签: iphone
我有一个带有 4 个子视图的视图。
我的应用程序将同时支持描绘和横向模式。
4个子视图中,有一个视图只支持描绘。
我该怎么做。
提前谢谢你。
【问题讨论】:
标签: iphone
把它放在有问题的视图的 UIViewController 中。它应该可以解决您的问题。
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
switch(interfaceOrientation){
case UIInterfaceOrientationPortrait: return YES;
break;
case UIInterfaceOrientationLandscapeLeft: return YES;
break;
case UIInterfaceOrientationLandscapeRight: return YES;
break;
default: return NO;
break;
}
}
【讨论】:
我通过旋转屏幕解决了我的问题
if (toorientation == UIInterfaceOrientationPortrait) {
sub_view.transform = CGAffineTransformMakeRotation(degreesToRadin(0));
}
else if (toorientation == UIInterfaceOrientationPortraitUpsideDown){
sub_view.transform = CGAffineTransformMakeRotation(degreesToRadin(180));
}
else if (toorientation == UIInterfaceOrientationLandscapeLeft){
sub_view.transform = CGAffineTransformMakeRotation(degreesToRadin(-90));
}
else if (toorientation == UIInterfaceOrientationLandscapeRight){
sub_view.transform = CGAffineTransformMakeRotation(degreesToRadin(90));
}
【讨论】: