无法仅旋转一个视图
我正在使用 XCode 4.2(带有情节提要)
我试图仅旋转其中一个视图(而不是所有视图),但它似乎不起作用...要么没有视图被旋转,要么
我拥有 所有视图检查了摘要中所有支持的视图,并在信息中确保应用程序“支持的界面方向”都存在于
与视图相关的类中,我编写了旋转此特定视图的函数:
-(BOOL) shouldAutoRotateToInterfactOrientation:(UIInterfaceOrientation)interfaceOrientation{
return(interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown||
interfaceOrientation != UIInterfaceOrientationPortrait||
interfaceOrientation != UIInterfaceOrientationLandscapeRight||
interfaceOrientation != UIInterfaceOrientationLandscapeLeft)
}
但仍然没有当我旋转屏幕时旋转...任何线索?
i am using XCode 4.2 (with storyboards)
I am trying to rotate only one of the views (and not all the views) but it doesn t seem to be working... either non of the views get rotated or all of them
I have checked all the supported views in the summary , and in info I made sure that the application "supported interface orientations" are all there
in the class that is related to the view I wrote the function to rotate this specific view :
-(BOOL) shouldAutoRotateToInterfactOrientation:(UIInterfaceOrientation)interfaceOrientation{
return(interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown||
interfaceOrientation != UIInterfaceOrientationPortrait||
interfaceOrientation != UIInterfaceOrientationLandscapeRight||
interfaceOrientation != UIInterfaceOrientationLandscapeLeft)
}
and still it does not rotate when I rotate the screen ... any clue ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的方法可以简化为:
您想要做的就是让设备支持所有您想要的方向的方向,然后在特定视图中,使用上面的方法来允许您想要该视图的方向。例如,如果您只需要特定视图的横向模式,您可以使用:
希望有帮助!
Your method can be reduced to:
What you want to do is have the device support orientations in all of the orientations you want, and then in the specific view's, use the above method to allow which orientations you want for that view. So for example, if you wanted only landscape modes for a particular view, you would use:
Hope that Helps!
在shouldAutorotateToInterfaceOrientation中,您必须返回您想要支持的所有方向。
因此,如果您希望您的应用程序仅以纵向方式工作,请使用以下代码:
如果您想支持所有可能的方向:
In
shouldAutorotateToInterfaceOrientation
you have to return all the orientations that you want to support.So if you want your app works just in portrait this is the code to use:
If you want to support all possible orientations: