【问题标题】:Landscape app for ipad doesn't have home screen landscapeipad 的横向应用程序没有主屏幕横向
【发布时间】:2012-07-09 06:32:49
【问题描述】:

我正在为 iPad 创建横向应用程序,但是当我运行该应用程序时,我发现主屏幕显示为纵向。我该如何解决?

【问题讨论】:

标签: iphone ios ipad


【解决方案1】:

选择目标,在“支持的设备方向”中仅选择横向左和横向右选项。以及在您的 roo 视图控制器集中

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if(UIInterfaceOrientationIsLandscape(interfaceOrientation))
        return YES;
    return NO;
}

【讨论】:

  • - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);感谢您的回复,但我已经实现了上面的这种方法......现在我该怎么办?
  • 检查 info.plist 一旦“支持的界面方向(iPad)”必须只包含以下两个值... UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRight
  • 我检查了 info.plist,“支持的界面方向包含相同的值..所以请您提供另一个解决方案..??
  • 转到您的 .xib 文件,在其中选择视图并将视图的方向属性(在第 4 个选项卡中)更改为“横向”
  • 对不起,但那里的方向也是横向的.. :(
【解决方案2】:

确保您的应用在项目设置中仅支持横向(取消选择“纵向”和“倒置”):

支持横向的视图控制器也应该说他们支持:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

【讨论】:

  • 谢谢你的回答,但我已经实现了这个方法,但我仍然无法获得横向主屏幕
  • 谢谢你的回复,但我已经实现了这个方法
【解决方案3】:

添加这个方法

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{

// Return YES for supported orientations
NSLog(@"Changed interface orientation");

return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
        );

}

【讨论】:

  • - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);感谢您的回复,但我已经实现了上面的这种方法......现在我该怎么办?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-04-04
  • 1970-01-01
  • 1970-01-01
  • 2020-08-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多