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

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

问题描述

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

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

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

这里是整个项目:https://github.com/tomkincaid/rotate>

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

另一个更新:如果我将视图放在导航控制器中,它就可以工作.所以 View 有效,Tab>Nav>View 有效,但 Tab>View 无效.

解决方案

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

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

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.

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?

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.

Here is the whole project: https://github.com/tomkincaid/rotate

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.

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.

解决方案

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天全站免登陆