Strange behavior of the navigation panel of the Split View controller

I found the rather odd behavior of the UINavigationBar of UISplitViewController . I have a stadard rootViewController in the image below:

enter image description here

When the bar button is pressed (it is temporarily used for debugging in the form of the "Add" button), I add a new navigation bar (NOTE: I add, I do not replace!), Which processes events that are executed on the screen.

Explanation - the button is pressed, and the user begins to draw material on the screen, a new panel is added for interaction to stop the drawing mode.

The problem is however, when I add this bar, a strange graphic detail appears where the panel of my rootViewController splits into two parts. Image below (marked in red):

enter image description here

Is this a known issue, or is it for some 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 to EXPLAIN why this is happening.

+4
source share
1 answer

Your second navigation bar is added a little lower than the first, so you see the division in the blue bar. As for why, I cannot say without additional information about how you add it.

0
source

Source: https://habr.com/ru/post/1445080/


All Articles