tags:

views:

2855

answers:

4

I have a tabbed application with each tab having a navigation controller. I use helper code to push a view/controller pair onto the navigation stack yet when I call this same code from two different places I get (suprizingly) different results. In one case the view renders lower than in the other case, seemingly lower by a navigation bar height.

Pushed from one tab (in good position) :

Pushed from another tab (too low):

The XIB:

Here is the push code:

+ (void)navigateToLocation:(Location*)location controller:(UIViewController*)vc withDelegate:(NSObject <LocationEditDelegate> *)delegate {

    LocationDetailsViewController *detailsController = [[LocationDetailsViewController alloc] initWithNibName:@"LocationDetailsViewController" bundle:nil];

    detailsController.title = [location display];
    detailsController.location = location;
    detailsController.delegate = delegate;

    // Push the detail view controller
    [[vc navigationController] pushViewController:detailsController animated:YES];

    [detailsController release];
}

Can anybody help me understand what might be going on, and how I get inside this?

I have 2.2.1 installed and build/deploy using 2.2.

Since comments do not appear to show, I am annotating at the bottom. Edit this if I am doing things incorrectly:

  • I have added simulated metrics with no change in behavior.
A: 

This is almost certainly related to not using simulated metrics in the XIB. Try adding a simulated Navigation Bar to your XIB and see if it changes anything.

Can Berk Güder
Thanks for the idea. A useful tool to know. I tried it w/o successful change though.
Adam Jack
A: 

Does one of tabs not have a navigation bar to start with?

Also, It looked like the green bar at the bottom is in the same XIB as the rest of the view, yet it was not pushed down. Is that correct?

If so, another solution would be to go to the ruler tab for all the upper elements and make sure that they are locked to the top edge of the view so that they cannot be moved down...

Kendall Helmstetter Gelner
Not to my knowledge. As I mentioned, I did rework this to a tab controller from a more simple view, but looking at the MainWindow.xib each tab has a Navigation Controller child.
Adam Jack
The green bar is a toolbar, and that seems to dynamically "float up" by itself independent of other components on the screen. I think it is it's nature.
Adam Jack
They are all locked to the top. :( Hence, I feel the view is being shifted down somehow.
Adam Jack
+2  A: 
Adam Jack
A wild guess, but maybe this happened because the Navigation Bar was previously translucent (so it would allow content below it)?
benzado
+2  A: 

I've had this problem a while ago. If I remember correctly, off the top of my head, there was an "Autoresize view to fill screen" box that was checked in IB. I think it was somewhere on the tabbar. Deselecting it solved my problem

nduplessis
Thank you, I had a similar problem and it helped me.
Ilya