Answer the question
In order to leave comments, you need to log in
How to push UIView to the bottom of parent view using NSLayoutConstraint?
There is a UIView (blue in the picture) with a fixed height of 45px, you need to press it to the bottom using autolayout (NSLayoutConstraint).
It turned out to press UIButton in this way, but it is not clear how to do it with view.
ps is interested in the implementation of the code without InterfaceBulder
Tried like this:
CGRect frame = CGRectMake(0, 500, self.view.frame.size.width, 45);
UIView *bottom = ;
Answer the question
In order to leave comments, you need to log in
I prefer to use Visual Format Language
NSArray *verticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[view(height)]-|"
options:0
metrics:@{
@"height" : @(50)
}
views:@{
@"view" : view
}];
NSArray *horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[view]-0-|"
options:0
metrics:nil
views:@{
@"view" : view
}];
[self.view addConstraints:verticalConstraints];
[self.view addConstraints:horizontalConstraints];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question