与 UIButton 冲突的 Textfield 的约束 [英] Constraints of Textfield conflicting with UIButton

查看:22
本文介绍了与 UIButton 冲突的 Textfield 的约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还在学习约束的学习过程中,请多多包涵:

I am still in the learning process of learning constraints, so bear with me:

在 xCode Interface Builder 中,我的 UI 如下所示:

In xCode Interface Builder, my UI looks like the following:

顶部 TextField 设置了以下约束:

The top TextField has the following constraints set up:

而右侧的倒车按钮有以下限制:

And the reverse button on the right has the following constraints:

当我在调试器中运行它时,我得到一个配置错误的用户界面:

When I run it in the debugger, I get a misconfigured UI:

这里到底发生了什么?为什么我的反向按钮增加到一个巨大的大小并移动到一个奇怪的位置,为什么第一个 TextField 缩小了?

What exactly is happening here? Why is my reverse button increasing to a huge size and displacing to a weird position and why is the first TextField shrunk?

理想情况下,我希望我的调试器 UI 在第一张图片中看起来像我的 Interface Builder.我正在通过界面构建​​器而不是以编程方式设置这一切.

Ideally, I want my debugger UI to look like my Interface Builder in the first image. I am setting this all up through the interface builder and not programmatically.

推荐答案

由于您的按钮没有高度和宽度...这可能需要按钮的固有图像大小,您可能会得到冲突的输出...

As your button had no height and width...this may take a intrinsic size of image for button and you may get conflicting output...

这是图片和限制条件...可能适合您...

Here is the image and constraints...may be work for you...

这篇关于与 UIButton 冲突的 Textfield 的约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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