0
votes

I've followed a how-to to create a simple Tab bar controller with a navigation controller in the first tab. Until here all is working correctly, expect a strange issue on the layout. When the app starts the first time, the Navigation Bar on the top of the first loaded nib is a little outside of the view. I cannot figure out why this happen. In the first view there is a button "Add new System" that opens a modal view. If I press this button and the modal view appears and then I dismiss the modal going back to the initial view, then the Navigation bar at the top is placed/refreshed correctly. The same happens if I press the second TAB (it's a simple nib without Navigation controller for now) and then back to the first TAB, the Navigation bar is placed in the correct position. Here a screenshot on the first startup:

Startup

And here when I press the modal view or the second TAB and then back to the first view:

After

The code is quit simple following one of the numerous tutorials on the net. I'm NOT using storyboard. Only customization was adding the buttons on the top of the Navigation Bar:

UIImage *editbuttonImage = [UIImage imageNamed:@"edit_pressed.png"];
UIButton *editButton = [UIButton buttonWithType:UIButtonTypeCustom];
[editButton setBackgroundImage:editbuttonImage forState:UIControlStateNormal];
editButton.frame = CGRectMake(0, 0, editbuttonImage.size.width, editbuttonImage.size.height);
[editButton addTarget:self action:@selector(leaveEditMode) 
       forControlEvents:UIControlEventTouchUpInside];

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] 
                                          initWithCustomView:editButton];

[editButton release];
[editbuttonImage release];

No other modifications were made. The nib was used before in a single view. Then I've tried to insert it into a TAB Controller + Navigation Controller. I could post the whole code in case it's needed. Under Select System there is a Table View, in these pictures empty, also not shown.

Thank's for the help!

Simon

1
I've solved the issue myself. On startup I've setup to hide the status bar and shown it again in the app delegate. The directive used :[[UIApplication sharedApplication] setStatusBarHidden:NO]; was after adding the navController as subview. Also the Navigation controller BAR was not out of the view, simply under the status bar. - Simon

1 Answers

0
votes

I've solved the issue myself. On startup I've setup to hide the status bar and shown it again in the app delegate. The directive used :

[[UIApplication sharedApplication] setStatusBarHidden:NO];

was after adding the navController as subview. Also the Navigation controller BAR was not out of the view, simply under the status bar.

Hope this helps someone :)

Cheers, Simon