iOS的滚动型,容器视图 - 自动布局问题 [英] iOS Scroll View, Container View - auto layout issue

查看:153
本文介绍了iOS的滚动型,容器视图 - 自动布局问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用故事板和放大器;自动布局。我有一个UIScrollView一个容器视图。容器视图允许我布局在故事板长(320,1000)视图。我设置的UIScrollView的内容大小为(320,1000)。结果
我压住了下面的约束上ContainerView的滚动型:结果
宽度等于:320结果
身高等于:1000结果
顶层空间到:上海华结果
对齐中心X为:上海华

I'm using storyboards & auto layout. I have a Container View in a UIScrollView. The Container View allows me to layout a long (320, 1000) view in the storyboard. I set the content size of the UIScrollView to (320,1000).
I pinned the following constraints on the ContainerView to the ScrollView:
Width Equals: 320
Height Equals: 1,000
Top Space to: Superview
Align Center X to: Superview

X $ C $ç坚持增加一个额外的约束。它增加了一个底部空间为:上海华等于:-432 。它不会让我删除此约束!我不知道这是否会影响下面的问题。

Xcode insists on adding an additional Constraint. It adds a Bottom Space to: Superview Equals: -432. It will not let me delete this constraint! I'm not sure if this affects the issue below.

一切正常,我的iPhone 5和模拟器的4画面上的罚款。结果
我的问题是当我测试它在模拟器和功放的3.5屏幕上;我的iPhone4S滚动显示的内容尺寸变限制为(320,568),失去了我的ContainerView的底部

Everything works fine on the 4" screen of my iPhone 5 and Simulator.
My problem comes when I test it on the 3.5" screen in the Simulator & my iPhone4S. The scrolling content size becomes restricted to (320, 568), losing the bottom section of my ContainerView.

有人可以帮助我理解为什么这不会对3.5的屏幕工作?

Can someone help me understand why this doesn't work on the 3.5" screens?

推荐答案

收到苹果技术支持问题的答案。它仍然给我X code。将错误,但它的3.5屏幕现在功能这里的答案:

Received the answer from Apple Tech support. It still gives me an error in Xcode, but it functions on 3.5" screens now. Here's the answer:

我不知道为什么界面生成器决定涉及容器视图滚动视图的内容视图中减去432的底部的底部,因为必须要完全定义的布局,则不能删除该约束[ 1]。然而,如果你的推广制约用户的限制,您可以编辑恒定值为零。这将纠正问题,即内容的底部是被切断。结果
在Interface Builder:结果
1)选择容器视图结果
2)切换到尺寸检查结果
3)点击齿轮图标旁边的底部空间为:上海华;等于:-432.0约束结果。
4)选择从菜单中选择和编辑。结果
5)在不断的字段中输入零值。

I'm not sure why interface builder decided to relate the bottom of the container view to the bottom of the scroll view's content view minus 432. You can not remove this constraint because it is necessary for the layout to be fully defined [1]. However, if you promote that constraint to a user constraint, you can edit the constant value to zero. This will correct the issue where the bottom part of your content was being cutoff.
In Interface Builder:
1) Select the Container View
2) Switch to the Size inspector
3) Click the gear icon next to the "Bottom Space to: Superview; Equals: -432.0" constraint.
4) Choose Select and Edit from the menu.
5) Enter a value of zero in the constant field.

[1]:见技术说明2154的在深入讲解部分获取更多信息。 <一href=\"https://developer.apple.com/library/ios/#technotes/tn2154/_index.html#//apple_ref/doc/uid/DTS40013309\">https://developer.apple.com/library/ios/#technotes/tn2154/_index.html#//apple_ref/doc/uid/DTS40013309

[1]: See the In Depth Explanation section of Technical Note 2154 for more information. https://developer.apple.com/library/ios/#technotes/tn2154/_index.html#//apple_ref/doc/uid/DTS40013309

这篇关于iOS的滚动型,容器视图 - 自动布局问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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