我通过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
答案 0 :(得分:0)
我添加了底部约束的出口,并进行了更改。谢谢@Bharat Modi