如何在 iPad 中设置横向模式视图?
我正在使用 iPad 工作。我希望我的应用程序仅在横向模式下修复。我的应用程序包含一个分割视图控制器,在分割视图控制器上方我放置了登录屏幕。
用户提供必要的用户名和密码后,应删除登录视图,以便打开分割视图控制器。效果很好。但我希望将登录屏幕设置为横向模式。我尝试了很多方法,但我的问题仍然没有解决。我在 plist 中放置了一个带有值 lanscape 的 UIOrientaion 键。但没有用。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//UIInterfaceOrientationLandscapeLeft;
// Overriden to allow any orientation.
// return UIInterfaceOrientationIsLandscape(interfaceOrientation);
return YES;
//return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
我也尝试过这种方式,但没有结果。
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
同样在 viewdidload 中,
通过使用这种方式,我可以将应用程序设置为横向模式,但视图不会旋转为横向。登录视图固定为纵向模式。
在 nib 文件中,如果我修复 lanscape 中的视图,则分割视图的 rootviewcontroller 出现在 e 侧以及 splitviewcontroller 的详细视图控制器中,此登录屏幕也会在肖像模式下打开......
任何帮助将不胜感激 提前致谢
I'm working with iPad. I want my app to fix at lanscape mode only. My app contains a split view controller and above split view controller I placed login screen.
After user provides the necessary username and password, the login view should be removed so that split view controller gets opened. It works good. But i want login screen to be set at landscape mode. I tried in so many ways but my problem is still not solved. I placed a UIOrientaion key with value lanscape in a plist. But no use.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//UIInterfaceOrientationLandscapeLeft;
// Overriden to allow any orientation.
// return UIInterfaceOrientationIsLandscape(interfaceOrientation);
return YES;
//return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
I tried in this way also but no result.
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
Also in this way in viewdidload,
By using this way im able to set the app in landscape mode but the view is not rotated to landscape.The login view is fixed at potrait mode.
In nib file,if i fix the view in lanscape,the split view's,rootviewcontroller appears on on e side and in the detailviewcontroller of splitviewcontroller,this login screen is opened that too in potrait mode.....
Any help will be appreciated
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了问题的解决方案。这是编码:
这样我们应该向委托添加子视图。之后通过视图控制器中的自动旋转方法修复横向视图..就是这样
i found solution to my problem.Here is the coding:
In this way we should add subviews to delegate.After that fix the view in landscape by auto rotation method in view controllers..thats it