1
votes

Right now, self.view is the height of the view controller minus the height of the nav bar and status bar, so when I hide these it messes my auto layout constraints up. Given how often the nav bar and status bar are hidden and unhidden, it would be easier just to give the view controller full height (but still allow the nav bar and status bar to be there at times), how exactly would I do this?

1
What do you want the view to do when you hide the navigation bar and the status bar? Grow to fill the space?rdelmar
No, I want it to do nothing as hopefully the view already occupies that space, so there's nothing to grow to. I want to think of the nav bar and status bar as almost a layer on top of the tall view in this case.Doug Smith
I don't know how to do this, but I don't understand the problem you say you have with messing up your constraints. When I hide the navigation bar, the view automatically expands to take up that space. The same happens when I hide the status bar, if I call setNeedsLayout on the view. What are you seeing get messed up?rdelmar
Basically it stems from this question. I thought not having to worry about constraints moving around due to size changes would make the problem go away.Doug Smith
I looked at your other question -- what is it that you want to happen if the use taps during that .35 second delay?rdelmar

1 Answers

1
votes

I'm not sure if I totally follow what you want, but I think it's something along these lines:

- (void) viewDidLoad
{
    [super viewDidLoad]
    self.view.frame = [[UIScreen mainScreen] bounds];

    // You may or may not want to reference [[UIDevice currentDevice] orientation], too

    // Other stuff, whatever you want to do...
}

Note, too, that you can turn-off auto-resize and constraints, if the problem you're having is related to those.

In general, the view controller's view not-including the nav-bar, etc. isn't a good idea. If you're having trouble because of that, you might want to consider another design.