Auto Layout with UITabBarController
I'm trying to shift to Auto Layout in my app, but I'm having some trouble
with my UITabBarController. Basically, I have two buttons on my home
screen, and I want them to have equal sizes, one 50 pixels from the top of
the screen and one 50 pixels from the bottom.
The issue is that when I do this:
NSArray* verticalConstraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"V:|-50-
[buttonOne(150)]" options:0 metrics:nil
views:NSDictionaryOfVariableBindings(buttonOne)];
[self.view addConstraints:verticalConstraints];
verticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:
[buttonTwo(==buttonOne)]-50-|" options:0 metrics:nil
views:NSDictionaryOfVariableBindings(buttonOne, buttonTwo)];
[self.view addConstraints:verticalConstraints];
The bottom button is 50 pixels from the bottom of the view, which is 568
points tall, when the height of self.view should be the screen height
minus the tab bar's height (the navigation bar is hidden). The majority of
this padding is eaten up by the height of the tab bar.
My questions is: Why is my view controller's view not resizing so that it
doesn't count the space under my tab bar as part of its height?
No comments:
Post a Comment