我发现UINavigationBar
的UISplitViewController
的奇怪行为。我有一个stadard rootViewController
下面的图片:分割视图控制器的导航栏的奇怪行为
当按下栏按钮(这是暂时的调试称呼为“添加按钮”),我添加了一个新的导航栏(注:我补充,我不替换!)处理在屏幕上完成的事件。
说明 - 按钮被按下,用户开始在屏幕上绘制东西,添加新的条以进行交互,以使绘图模式停止。
问题 - 但是,当我添加此栏时,出现了一个奇怪的图形细节,其中我的rootViewController
的栏分为两部分。下面的图片(标红):
它是一个已知的问题或者是有原因的?
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];
注:我不是寻找一个替代解决,但说明为什么发生这种情况。
为什么不添加UIToolBar来代替UINavigationBar? “ –
”工具栏 - 提供在屏幕底部显示工具栏的机制。“ – Michal
我在顶部使用过很多次UIToolBar ..一个例子当我提出modelViewController +苹果文档dosent也这么说。 –