[英]IOS/Objective-C/Autolayout Center four images horizontally
使用UIStackView
進行以下工作:
let stackView = UIStackView()
stackView.distribution = .fill
stackView.alignment = .center
stackView.axis = .horizontal
stackView.spacing = 30 // or whatever you need
// now add the dots to your stackView:
stackView.addArrangedSubview(dot1)
stackView.addArrangedSubview(dot2)
stackView.addArrangedSubview(dot3)
stackView.addArrangedSubview(dot4)
// and just add and lay out the stackView, stackView itself will take care of positioning the dots
self.view.addSubview(stackView)
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.