2012-11-09 138 views
4

我发现UINavigationBarUISplitViewController的奇怪行为。我有一个stadard 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]; 

注:我不是寻找一个替代解决,但说明为什么发生这种情况。

+0

为什么不添加UIToolBar来代替UINavigationBar? “ –

+0

”工具栏 - 提供在屏幕底部显示工具栏的机制。“ – Michal

+0

我在顶部使用过很多次UIToolBar ..一个例子当我提出modelViewController +苹果文档dosent也这么说。 –

回答

0

您的第二个导航栏添加了比第一个低一点的位置,所以您会看到蓝色栏中的分区。至于为什么,如果没有更多关于如何添加它的信息,我不能说。

+0

我添加了代码,我认为我并没有把它放在比我应该低的位置。此外,当条形下降时,整个动画中可以看到“针迹”。 – Michal

相关问题