这是我尝试的代码:
videoId
尝试添加 @IBOutlet weak var btnInfo: UIButton!
override func viewWillAppear(_ animated: Bool) {
self.view.addConstraint(NSLayoutConstraint(item: self.view,
attribute: .topMargin,
relatedBy: .equal,
toItem: btnInfo,
attribute: .notAnAttribute,
multiplier: 1,
constant: 20))
self.view.addConstraint(NSLayoutConstraint(item: self.view,
attribute: .rightMargin,
relatedBy: .equal,
toItem: btnInfo,
attribute: .notAnAttribute,
multiplier: 1,
constant: 30))
}
和.topMargin
约束,以使.rightMargin
从顶部显示30个点,从右边距显示30个点。请帮忙。