UIButton标题未在UIStackView中显示

时间:2023-01-17 21:41:54

I created a UIStackView with a UIImageView and a UIButton. The text inside of the UIButton won't show. I can tell that autolayout works because the background and the selection of my UIButton both work properly.

我用UIImageView和UIButton创建了一个UIStackView。 UIButton内部的文本不会显示。我可以告诉autolayout有效,因为我的UIButton的背景和选择都能正常工作。

The title always disappears when I have the constraints on. I set the image to 0/0/0/0 without margins and aligned the button to the image's edges.

当我有约束时,标题总是消失。我将图像设置为0/0/0/0而没有边距,并将按钮对齐到图像的边缘。

UIButton标题未在UIStackView中显示 UIButton标题未在UIStackView中显示

Has anyone run into this or knows how to fix it?

有没有人碰到这个或知道如何解决它?

1 个解决方案

#1


0  

At the end I simply used a UIView. I don't know what made me use the UIStackView but I guess it's not made for overlaying objects.

最后我简单地使用了UIView。我不知道是什么让我使用UIStackView,但我想它不是用于覆盖对象。

#1


0  

At the end I simply used a UIView. I don't know what made me use the UIStackView but I guess it's not made for overlaying objects.

最后我简单地使用了UIView。我不知道是什么让我使用UIStackView,但我想它不是用于覆盖对象。