Good evening all! I am developing an application in Portait orientation and i was wander if there is a way for me to change the orientation of only one view to landspace left without messing with the rest of the app.
晚上好!我正在开发一个以Portait为导向的应用程序,如果有一种方法可以让我将一个视图的方向更改为剩余的空间而不会弄乱应用程序的其余部分,我就会徘徊。
I tried returning
我试着回来了
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
//return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
but with no luck... In IB the orientation for the View controller is set to landscape but when i run the app, it keeps appearing in portrait mode... Also tried setting the
但没有运气......在IB中,View控制器的方向设置为横向,但是当我运行应用程序时,它仍然以纵向模式显示...也尝试设置
[[UIApplication sharedApplication]setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO];
with no luck...
没有运气......
Any help will be greatly appreciated.
任何帮助将不胜感激。
Thank you.
3 个解决方案
#1
2
The only thing that worked for me was using
唯一对我有用的是使用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
in my ViewController and presenting it with presentModalViewController. This forces the View to stay in landscape.
在我的ViewController中,并使用presentModalViewController进行呈现。这迫使视图保持在景观中。
#2
3
You can manually set the transform of the view to rotate it. For example, to rotate 90 degrees:
您可以手动设置视图的变换以旋转它。例如,要旋转90度:
view.transform = CGAffineTransformMakeRotation( M_PI / 2 );
#3
1
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
Write in your Event.
写下你的活动。
#1
2
The only thing that worked for me was using
唯一对我有用的是使用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
in my ViewController and presenting it with presentModalViewController. This forces the View to stay in landscape.
在我的ViewController中,并使用presentModalViewController进行呈现。这迫使视图保持在景观中。
#2
3
You can manually set the transform of the view to rotate it. For example, to rotate 90 degrees:
您可以手动设置视图的变换以旋转它。例如,要旋转90度:
view.transform = CGAffineTransformMakeRotation( M_PI / 2 );
#3
1
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
Write in your Event.
写下你的活动。