如何设置UIStackView的cornerRadius? [英] How can I set the cornerRadius of a UIStackView?
问题描述
由于大多数人应该已经更新到iOS 9,因此我正在更新我的应用程序以使用UIStackViews.
I'm updating my app to use UIStackViews, now that most people should have updated to iOS 9.
在旧版本中,我制作了一个由两个UITextField组成的UIView并设置了它的layer.cornerRadius属性.
In the old version, I made a UIView consisting of two UITextFields and set its layer.cornerRadius property.
在新版本中,我创建了一个由两个相同的UITextField组成的UIStackView,而不是UIView.当我尝试设置其layer.cornerRadius属性时,似乎什么都没有发生.该文档似乎没有任何有用的/相关的信息.
In the new version, I created a UIStackView consisting of the same two UITextFields, instead of the UIView. When I try setting its layer.cornerRadius property nothing seems to happen. The documentation doesn't seem to have any helpful/relevant information.
推荐答案
UIStackView
仅管理其排列视图的位置和大小,cornerRadius无效.尝试在stackView下面添加一个自定义视图,并设置它的cornerRadius.
UIStackView
just manages the position and size of its arranged views, the cornerRadius has no effect. Try to add a custom view below the stackView and set the cornerRadius of it.
这篇关于如何设置UIStackView的cornerRadius?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!