I have a UIViewController presenting in UINavigationController. In viewDidLoad, I added a UIView(self.loadingView) to UIViewController with below auto layout code:
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.loadingView attribute:NSLayoutAttributeWidth multiplier:1 constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.loadingView attribute:NSLayoutAttributeHeight multiplier:1 constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.loadingView attribute:NSLayoutAttributeTop multiplier:1 constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.loadingView attribute:NSLayoutAttributeLeading multiplier:1 constant:0]];
After running, I find that the self.loadingView is larger than the screen, and I can't see the bottom of self.loadingView, since we have an additional UINavigationbar above this view.
I can manually resize self.loadingView to fix this issue, but how to do it automatically. Specifically, I don't want to add self.loadingView.frame.height-=44
in my project.