Xcode/Stackview,堆栈视图中的空标签吓坏了? [英] Xcode/Stackview, empty labels freaks out in stack view?

查看:20
本文介绍了Xcode/Stackview,堆栈视图中的空标签吓坏了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望这里很简单.我有一些标签和文本字段.在它们之间,我想要一些空标签,如果需要,它们将是错误文本.但是当我尝试将其全部堆栈查看时,Xcode 缩小并且在 viewController 上看不到任何内容.我还需要更改什么才能使其正常工作吗?

hopefully an easy one here. I have some labels and text fields. Between them, I want some empty labels, which will if needed to be error texts. But when I try to stack view it all, Xcode zooms out and nothing can be seen on the viewController. Anything else I need to change for it to work?

在我点击堆栈视图之前,您可以在这里看到它的图片:

You can see a picture of it here before I hit stack view:

电子邮件标签和文本字段已经在堆栈视图中,密码、gentag 密码和标签/按钮也是如此.

The email label and text field are already in stack view, so are passwords, gentag passwords and label/button.

推荐答案

这显然是一个错误.我复制了你的问题.在将它添加到我的堆栈视图之前,我能够通过为每个空的间隔标签设置高度/宽度来解决它.这是没有意义的,因为当您将一个对象添加到堆栈视图时,它会失去它所具有的所有约束.尽管如此,它解决了问题:

This certainly appears to be a bug. I duplicated your issue. I was able to solve it by setting a height/width to each empty spacer label, prior to adding it to my stack view. This doesn't make sense because when you add an object to a stack view it loses all of the constraints it has. None the less it resolved the issue:

这篇关于Xcode/Stackview,堆栈视图中的空标签吓坏了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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