I found rather odd behavior of UINavigationBar
of UISplitViewController
. I have a stadard rootViewController
on the picture below:
When the bar button is pressed(it is temporarily for debug styled as "Add button"), I add a new Navigation bar(NOTE: I add, I do not replace!) that handles events done on screen.
Explanation - the button is pressed and user starts drawing stuff on screen, the new bar is added for interaction to make the drawing mode stop.
Problem - however, when I add this bar a strange graphical detail appears where the bar of my rootViewController
is split in two pieces. Picture below(marked red):
Is it a known issue or is it there for a reason?
CODE:
UINavigationBar *tmpBar = [[UINavigationBar alloc] initWithFrame:CGRectOffset(CGRectMake(0.0, 0.0, 1024.0, 44.0), 0, - 44.0)];
UINavigationItem *it = [[UINavigationItem alloc] initWithTitle:@"Draw, baby, draw!"];
it.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelDrawing)];
it.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(sendMail)];
tmpBar.items = [[NSArray alloc] initWithObjects:it, nil];
self.canvasBar = tmpBar;
[self.splitViewController.view addSubview:self.canvasBar];
[self.splitViewController.view bringSubviewToFront:self.canvasBar];
[UIView beginAnimations:@"animateBarOn" context:NULL];
[UIView setAnimationDuration:1.0];
[self.canvasBar setFrame:CGRectOffset([self.canvasBar frame], 0, 44)];
[UIView commitAnimations];
NOTE: I am not looking for an alternative solution, but for EXPLANATION why this is happening.
Your second nav bar is added a bit lower than the first, so you are seeing the division in the blue bar. As for why, I can't say without more information on how you are adding it.