Reputation: 1466
Hello guys i have one that is. I have two buttons in controller when i remove or hidden one button i want to other button to increase size according to width. Here i am using the auto layout so please post your answer accordingly
See the above image when i hide the button other button it should be adjust with the size.
Upvotes: 0
Views: 1899
Reputation: 1247
you can add this constraint manually by creating its outlet of "width constraint" like below :
And wherever you want to re-set its width then you can do it manually,
- (IBAction)buttonClicked:(id)sender
{
[UIView animateWithDuration:0.15 animations:^{
_widthConstraint.constant = 100;
}];
[self.view layoutIfNeeded];
[self.view updateConstraints];
}
Upvotes: 0
Reputation: 14040
and that's it!
Upvotes: 2
Reputation: 846
Use UIStackView as if it supports iOS 6. It will automatically replace the symbol for UIStackView into FDStackView at runtime before iOS 9.
Or you can using a array of UIView to hold the buttons you want. The first and last element of the array is a 1px width 0.01 alpha UIView. Making the first's left align to the left of screen and the last's right align to the right of screen.
The all you need to do is that put the buttons in the array and make sure every buttons are between the 1px views.
Upvotes: 0