【问题标题】:Problem in set view in Landscape mode横向模式下设置视图中的问题
【发布时间】:2011-06-16 05:24:41
【问题描述】:

我有一个基于选项卡的应用程序,其中有 4 个视图与 4 个选项卡相关联。我想要所有 3 个纵向视图和一个横向视图。

我已经为该特定视图完成了这些设置:

在 info.plist 的 Supported interface orientations 中设置所需的值。

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
}

在 IB 中将方向属性设置为横向。

-(void)viewDidLoad我设置了self.view.frame=CGRectMake(0, 0, 480, 320);

完成以上所有设置后,它仍然无法进入横向模式。

【问题讨论】:

    标签: iphone objective-c ipad landscape uiinterfaceorientation


    【解决方案1】:

    如果我正确理解了您的问题,如果我没有正确理解,请纠正我,那么您希望始终拥有 3 个纵向视图和一个横向视图所有时间。为此,在viewWillAppear 中为每个viewController 设置状态栏的方向:

    -(void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
        [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
    }
    

    【讨论】:

    • @Arcana Chaurasia:见上文
    • 我已经实现了,但是这样做,设备正在更改为横向模式,但视图内容仍然是纵向的,只是根据设备更改了它的 x,y 坐标。是否可以在此处粘贴屏幕截图。如果是,怎么做?
    • @Arcana 首先,您应该删除手册self.view.frame=CGRectMake(0, 0, 480, 320); 并为shouldAutorotate 返回NO。是的,您可以上传屏幕截图。编辑您的帖子,然后在您键入的窗口顶部,将鼠标悬停在小图标上。一个读“添加图像”或“添加媒体”或类似的东西。
    • 我已经删除了上面所有的东西,但它仍然是这样的(见屏幕截图)。我想要底部的标签栏并以横向模式查看,但它会随着设备移动。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多