[英]How to change center of UIView, added in storyboard?
I have added an UIButton and an UIView through Storyboard, and created their IBOutlets 我已经通过Storyboard添加了UIButton和UIView,并创建了IBOutlets
@IBOutlet weak var popUpView: UIView!
@IBOutlet weak var nextButton: UIButton!
When I try to change center
or frame
, it does not work: 当我尝试更改
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)
}
But this works: 但这有效:
nextButton.layer.cornerRadius = 0.2 * nextButton.bounds.size.width
I added outlet of the bottom constraint, and change it. 我添加了底部约束的出口,并进行了更改。 Thanks @Bharat Modi
谢谢@巴拉特·莫迪
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.