本文介绍了iPad上的标签视图未调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的视图无法延伸以适应当前方向!

My view doesn't stretch to fit the current orientation!

我正在创建一个标签栏应用程序。我复制了创建新标签栏应用程序时创建的示例。一切正常,除非我改变iPad的方向旋转视图,标签栏在底部伸展,但视图不会调整大小。基本上,如果你从横向开始然后旋转到肖像,它会旋转但视图仍然是横向形状,即使它旋转。

I am creating a tab bar application. I replicated the sample one that you create when you "create a new tab bar application". Everything works except when I change the orientation of the iPad it rotates the view, the tab bar stretches out on the bottom, but the view doesn't resize. Basically if you start in landscape then rotate to portrait, it rotates but the view is still landscape shape even though it rotates.

我的标签栏有两个标签(就像示例应用程序)所以我将矿山与按物业运作的样本进行了比较。一个区别是我注意到我在调整大小区域下的IB中的FirstView没有向左/向右/向上/向下显示调整大小箭头。换句话说,它没有标记为自动填充其容器。示例的FirstView和SecondView DO都有这些箭头。但我不能打开它们!

My tab bar has two tabs (just like the sample application) and so I compared mine against the sample which works property by property. One difference is I noticed my FirstView in IB under the resizing area doesn't show the resize arrows left/right up/down. In other words it isn't marked to auto fill its container. The sample's FirstView and SecondView DO have these arrows. But I can't turn them on!

我甚至尝试创建一个全新的视图,但我仍然无法按下这些箭头。我在这里做错了什么?'

I even tried creating a fresh new view but I still can't press these arrows on. what am I doing wrong here?'

非常感谢。

推荐答案

解决方案是:

self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

在viewDidLoad中执行此操作。 IB中必定存在错误。

Do this in viewDidLoad. There must be a bug in IB.

这篇关于iPad上的标签视图未调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 04:00