[英]How to change center of UIView, added in storyboard?
我已經通過Storyboard添加了UIButton和UIView,並創建了IBOutlets
@IBOutlet weak var popUpView: UIView!
@IBOutlet weak var nextButton: UIButton!
當我嘗試更改center
或frame
,它不起作用:
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
popUpView.center = CGPoint(x:50,y:50)
nexButton.frame = CGRect(x: 0, y: 50, width: 100, height: 100)
}
但這有效:
nextButton.layer.cornerRadius = 0.2 * nextButton.bounds.size.width
我添加了底部約束的出口,並進行了更改。 謝謝@巴拉特·莫迪
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.