iPhone:方向问题
我从互联网上得到了一个示例应用程序。我试图改变它的方向。
为了改变方向,我编写了以下代码:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
并且还对 xib 的自动调整大小进行了更改。
但它仍然不起作用。我应该怎么办 ?
I got a sample app from internet. In which I am trying to change it's Orientation.
For changing the orientation I have write following coding :
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
And also made changes in xib's Auto-sizing.
But still its not working. What should I do ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该可行,但是如果您正在编写使用 TabBarController 的应用程序,则必须确保所有视图控制器从此方法返回 YES(对于某些方向,替代方案可能是 YES)。
This should work, however if you are writing an application that uses a TabBarController you have to ensure that all viewcontrollers return
YES
from this method (alternative could be YES for some orientations).在 info.plist 中添加 UISupportedInterfaceOrientations 并在其中添加所有四个方向,例如 UIInterfaceOrientationPortrait、UIInterfaceOrientationPortraitUpsideDown、UIInterfaceOrientationLandscapeLeft、UIInterfaceOrientationLandscapeRight 并启用所有四个方向。
Add UISupportedInterfaceOrientations in your info.plist and within that add all the four orientations like UIInterfaceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight and make all the four enabled.