分裂视图控制器导航栏的奇怪行为

时间:2012-11-09 14:57:12

标签: ios ipad ios6 uinavigationbar uisplitviewcontroller

我发现UINavigationBar UISplitViewController的行为很奇怪。我在下图中有一个标准rootViewController

enter image description here

当按下小节按钮时(暂时将调试样式设置为“添加按钮”),我添加一个新的导航栏(注意:我添加,我不替换!)来处理屏幕上完成的事件。

说明 - 按下按钮,用户开始在屏幕上绘制内容,添加新栏进行交互以使绘图模式停止。

问题 - 但是,当我添加此栏时,会出现一个奇怪的图形细节,其中rootViewController的栏分为两部分。下面的图片(标记为红色):

enter image description here

这是一个已知问题还是有原因?

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];

注意:我不是在寻找替代解决方案,但对于 EXPLANATION ,为什么会发生这种情况。

1 个答案:

答案 0 :(得分:0)

您的第二个导航栏比第一个导航栏略低,因此您可以看到蓝色栏中的分割。至于为什么,我不能说没有关于你如何添加它的更多信息。

相关问题