【问题标题】:root UIViewController orientation landscape, touches weird in subviews根 UIViewController 方向横向,在子视图中触摸奇怪
【发布时间】:2011-01-11 13:30:32
【问题描述】:

我正在制作一个仅限横向的应用程序。因此,我的根 UIViewController 设置为横向(我拥有的所有 xib 文件都是横向的)。

// Override to allow orientations other than the default portrait orientation.
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

当我尝试触摸其中一个子视图中的按钮时,它没有收到触摸。如果我删除上面显示的覆盖,按钮会被触摸,但子视图会以纵向显示。

我应该如何解决这个问题?

感谢和最好的问候,

大卫

【问题讨论】:

    标签: iphone uiviewcontroller orientation


    【解决方案1】:

    除此之外,您还必须在 info.plist 文件中设置支持的方向。

    它在“支持的界面方向”下,键为“UISupportedInterfaceOrientations”。删除列表中的纵向。

    【讨论】:

      猜你喜欢
      • 2023-03-22
      • 2013-04-05
      • 1970-01-01
      • 2012-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-24
      • 2013-02-21
      相关资源
      最近更新 更多