Can we add a NSLayoutConstraint
between self.navigationcontroller.navigationbar
and a view inside the self.view
. Here self is a UIViewController
instance and _textField
is a subview of self.view
What I need is that the UI should look alike irrespective whether the navigationBar
is Translucent or not.
I've tried the following. But It does not work.
NSLayoutConstraint* cn = [NSLayoutConstraint constraintWithItem:_textField
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:self.navigationController.navigationBar attribute:NSLayoutAttributeBottom
multiplier:1.0 constant:20];
[self.navigationcontroller.view addConstraint:cn];