我使用此代码来查看 Nib 到堆栈 View
for index in 0..<4 {
let view = CategoryClass.createMyClassView()
view.myLabel.text = "Hello World!"
self.stackView.addArrangedSubview(view)
}
我得到下面的图片:
但是我想按category.xib高度添加 subview (每个 View 40px)不填充。
并设置在父级的中心
如下:
屏幕截图:
最佳答案
Please add Four label in Xib and after put in stackView and give spacing like 5, 10, 20 whatever you like
Please check screenshot and let me know if u have any problem related stackview i will help you
关于Swift stackview 在中心添加 subview ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50565813/