iOS 7在标签栏中旋转视图时,视图右侧不可点击 [英] iOS 7 When Rotating View in Tab Bar, Right Side of View is Not Clickable

查看:106
本文介绍了iOS 7在标签栏中旋转视图时,视图右侧不可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的应用程序,包含一个视图。一切正常,应用程序旋转,屏幕右侧的按钮可点击。我正在使用iOS 7和Xcode 5.

I have a very simple app consisting of a single view. Everything works fine, the app rotates and buttons on the right side of the screen are clickable. I'm using iOS 7 and Xcode 5.

如果我进入故事板并选择视图然后执行编辑器>嵌入>标签栏控制器,现在应用程序从纵向旋转到横向,应用程序的右侧不可点击。它似乎距离左侧正好是768像素,它停止工作,所以它让我觉得应用程序中没有旋转的东西。可能有什么问题?

If I go into the storyboard and select the view then do Editor > Embed In > Tab Bar Controller, now when the app rotates from portrait to landscape, the right side of the app is not clickable. It seems to be exactly 768 pixels from the left where it stops working, so it makes me think there's something in the app that didn't rotate. What could be wrong?

这只是一个基本的单一视图向导应用程序,我在其上放置了一些UI元素进行测试。唯一让它停止工作的是嵌入标签栏。

It's just a basic single view wizard app that I put some UI elements on it to test. The only thing that makes it stop working is embedding in the tab bar.

以下是整个项目: https://github.com/tomkincaid/rotate

更新:我最初使用的是同一个iPhone故事板iPhone和iPad都认为这可能是个问题。但是,我创建了一个新的iPad故事板,它有同样的问题。

Update: I had originally used the same iPhone storyboard for both iPhone and iPad and thought this might be the issue. However, I created a new iPad storyboard and it has the same issue.

另一个更新:如果我把视图放在导航控制器中,它就可以了。所以View工作,Tab> Nav> View工作,但Tab> View不起作用。

Another Update: If I put the view inside a navigation controller, it works. So View works and Tab>Nav>View works, but Tab>View doesn't work.

推荐答案

我遇到了同样的问题。将以下代码放在我的视图控制器的viewDidLoad中修复它:

I had the same problem. Putting the following code in my view controller's viewDidLoad fixed it:

self.view.autoresizesSubviews = YES;
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

这篇关于iOS 7在标签栏中旋转视图时,视图右侧不可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆