Вы можете сделать это так быстро:
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
let yConstraint = NSLayoutConstraint(item: toastView, attribute: .Top, relatedBy: .Equal, toItem: view, attribute: .Top, multiplier: 1, constant: view.bounds.height * 0.8 )
NSLayoutConstraint.activateConstraints([yConstraint])
}
Цель c
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
NSLayoutConstraint *topAnchorConstraint = [NSLayoutConstraint constraintWithItem:toastView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:view attribute:NSLayoutAttributeTop multiplier:1 constant:(view.bounds.size.height * 0.8)];
[self.view addConstraint:topAnchorConstraint];
}