简体   繁体   English

iPhone:自动布局不起作用

[英]iPhone: Auto Layout Not Working

I have a problem with autolayout. 我有自动布局的问题。 The Table View below the Image View should resize to fill the whole space below when the App runs on an iPhone 5, but it doesn't. 当应用程序在iPhone 5上运行时,图像视图下方的表视图应调整大小以填充下面的整个空间,但事实并非如此。 What is the problem? 问题是什么?

在此输入图像描述

Your table view should have a vertical spacing constraint to the image view and another one to the bottom of the screen. 您的表视图应该对图像视图具有垂直间距约束,而另一个对应于屏幕底部。 It should have no height constraint. 它应该没有高度限制。

After Edit: 编辑后:

I'm not sure what all your constraints are. 我不确定你的所有限制是什么。 It seems that something needs a fixed height (or some way to tell the system what the relative heights of the image view and table view are). 似乎某些东西需要一个固定的高度(或某种方式告诉系统图像视图和表格视图的相对高度是多少)。 It worked fine for me to give the image view a fixed height, and with these constraints for the image view and table view: 它对我来说很合适,可以为图像视图提供一个固定的高度,并为图像视图和表视图提供以下约束:

image view: 图像视图:

在此输入图像描述

table view: 表格视图:

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM