iPad标题栏。导航栏或工具栏? [英] iPad title bars. Navbars or toolbars?
问题描述
我看到一堆适用于iPad的应用程序非常棒的标题栏。这些似乎是导航栏和工具栏的组合。他们通常有一个后退按钮和一个标题以及男人的其他按钮。导航栏仅支持左项,右项和标题视图。而工具栏并不真正支持后退按钮或标题。
I see a bunch of apps for iPad with really cool title bars. These seem to be a combination of a navigation bar and a toolbar. They usually have a back button and a title as well as men other buttons. And a navbar only supports a left item, a right item and and title view. And the toolbar does not really support back buttons or titles.
那么如何在我的UINavigationController驱动的应用程序中使用许多按钮实现这些丰富的导航栏?
So how do I implement these rich navbars with many buttons on my UINavigationController driven application?
推荐答案
您可以通过在 UINavigationItem
中添加 UIToolbar
来获得此效果,如下所示:
You can get this effect by putting a UIToolbar
in your UINavigationItem
like so:
self.navigationItem.title = @"My Title";
UIToolbar *tb = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
tb.items = [NSArray arrayWithObjects:button1,button2,button3,nil];
UIBarButtonItem *tbItem = [[UIBarButtonItem alloc] initWithCustomView:tb];
self.navigationItem.rightBarButtonItem = tbItem;
[tbItem release];
[tb release];
来源:这个博客,通过谷歌。
这篇关于iPad标题栏。导航栏或工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!