Reputation: 519
I setup a view controller scene with interface builder. I add a view to my controller and add a custom class (CustomView) to it.
The view controller code
class ViewController: UIViewController {
@IBOutlet var myCustomView: CustomView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(animated: Bool) {
print(myCustomView.frame.origin)
}
}
The question
Why the origin of myCustomView
is equal to (-4.0, 64.0) and not (0, 64) ?
Upvotes: 0
Views: 171
Reputation: 22374
when you add the constraints,your constraints to margin remains unchecked. Because of constraints to margin
it gives you a frame that starts with (-4.0,64.0) like that...
Try to pinned all your edges without constraints to margin that will solve your problem ..
For more guide about constraints to margin, check this link
Upvotes: 1