如何在swift中指定属性之间的垂直间距 您正在使用水平stackView。“垂直空间”到底是什么意思? func showContactInformation(){ scrollView.addSubview(contactHeader)
如何在swift中指定属性之间的垂直间距如何在swift中指定属性之间的垂直间距 您正在使用水平stackView。“垂直空间”到底是什么意思? func showContactInformation(){ scrollView.addSubview(contactHeader) ,swift,Swift,如何在swift中指定属性之间的垂直间距 您正在使用水平stackView。“垂直空间”到底是什么意思? func showContactInformation(){ scrollView.addSubview(contactHeader) contactHeader.anchor(leadTitle.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, topConstant: 16
您正在使用水平stackView。“垂直空间”到底是什么意思?
func showContactInformation(){
scrollView.addSubview(contactHeader)
contactHeader.anchor(leadTitle.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, topConstant: 16, leftConstant: 16, bottomConstant: 0, rightConstant: 16, widthConstant: view.frame.width, heightConstant: 40)
let contTitle_attribute = NSMutableAttributedString(string: "Customer", attributes: [NSAttributedString.Key.font: UIFont.openSansRegular_12])
contTitle_attribute.append(NSAttributedString(string: "\nEmail", attributes: [NSAttributedString.Key.font: UIFont.openSansRegular_12]))
contTitle_attribute.append(NSAttributedString(string: "\nPhone", attributes: [NSAttributedString.Key.font: UIFont.openSansRegular_12]))
contactTitle.attributedText = contTitle_attribute
let contactDetail_attribute = NSMutableAttributedString(string: "Ehsan", attributes: [NSAttributedString.Key.font: UIFont.openSansRegular_12])
contactDetail_attribute.append(NSAttributedString(string: "\nien77@gmailcom", attributes: [NSAttributedString.Key.font: UIFont.openSansRegular_12]))
contactDetail_attribute.append(NSAttributedString(string: "\n34343434", attributes: [NSAttributedString.Key.font: UIFont.openSansRegular_12]))
contactDetail.attributedText = contactDetail_attribute
let stackView = UIStackView(arrangedSubviews: [contactTitle, contactDetail])
stackView.distribution = .fillEqually
stackView.translatesAutoresizingMaskIntoConstraints = false
stackView.spacing = 5
stackView.alignment = .leading
stackView.axis = .horizontal
scrollView.addSubview(stackView)
stackView.anchor(contactHeader.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, topConstant: 16, leftConstant: 16, bottomConstant: 0, rightConstant: 16, widthConstant: view.frame.width, heightConstant: 90)
}