0

嗨,我是 ios 开发的新手...

我在仅支持景观的项目上创建了。为此我像这样使用设置图片

但是当我要打印视图大小时

  NSLog(@"%f--%f",self.view.frame.size.width,self.view.frame.size.height);

在日志中给出

   768.000000--1024.000000

代替

 1024.000000--768.000000

我还添加了一个代码

   - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
          {
         BOOL res=((interfaceOrientation == UIInterfaceOrientationLandscapeLeft)||       (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
return res;
        }

我不知道如何解决这个问题。请帮助我

4

1 回答 1

1

有时甚至像这样设置失败检查解决方案

在您的应用程序的属性文件 (YOURAPPNAME-Info.plist) 中,有一个名为“支持的界面方向”的数组。从数组中删除您不想要的方向,您的应用程序将被锁定到剩余的方向。

在 iOS 6 setOrientation 已贬值,您应该将其替换为:

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

并且仅对方向方法中的风景返回 true

于 2013-10-25T20:44:42.447 回答