目前我正在与之合作。我已经多次将约束设置为0,0,0,0,并且限制为未选中的边距。但是,有时我运行模拟器它不会填满屏幕,但保持在600x600。我的高度和宽度未经检查,因此我添加的唯一限制是-20 - > 0和20 - > 0.
尺寸等级仅适用于平板电脑和iPhone功能,或者我可以取消选择并将应用程序面向iPhone,但仍然管理从iPhone到iPhone的大小变化?
编辑:未经检查的尺寸类并已选择iPhone,但我仍然遇到方形地图视图的问题。
EDIT2:在这里添加了约束的图像,由于某种原因它不保存或使用加载的约束。 http://imgur.com/9KGY7Nn
解决:无论出于何种原因,xcode都没有将上限和下限添加到0。"添加缺失的约束"解决了这个问题。
答案 0 :(得分:2)
I know you answered your own question, but I'm just going to put an answer here for anyone later having this problem.
If you see a red outline, or red constraints in interface builder, that indicates that you have an error (due to something like a missing or conflicting constraint). If you're getting a red outline/constraint you won't get what you're looking for when you run the app. You should try and fix this problem to get the desired outcome.
In your case You have a leading and trailing constraint, however this is not sufficient, and you must add a top and bottom margin.
When your outline is orange/yellow, this means that you have a warning, it's not going to break, but something is out of place. This usually fixes itself if you click update frames
under resolve auto layout issues
at the bottom right of the screen.
Also if you want to have a full screen map on all devices consider adding your constraints in the any - any
class.