0

我有一个项目,我使用 aNavigationController作为我的SplitViewController.

因此,当应用程序出现时,两个方向的一切都很好。但是,一旦我在导航控制器中推送视图,如果我处于纵向模式,我的“显示主视图”(uisplitview 委托)按钮将消失,并且“后退”按钮uinavigationcontroller将取代它。如果我按下后退按钮弹出我的视图,“显示主视图”按钮就会回来。

UINavigationBar我的问题是,即使我推送了一些视图,我如何管理我希望能够在我的页面中显示两个按钮(“返回”、“显示大师”)的事实?

4

2 回答 2

1

您可以使用 UIToolbar 来完成。您必须首先隐藏导航栏并在视图顶部放置一个 UiToolbar。

现在您可以根据需要添加为按钮。

UIToolbar *tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 20, 1036, 42)];          
tools.barStyle = UIBarStyleBlackTranslucent;
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3];

UIBarButtonItem * backButton = [[UIBarButtonItem alloc] initWithCustomView:myCustomView];
[buttons addObject:backButton];

//you can add also a spacer
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[buttons addObject:spacer];

UIBarButtonItem * homeButton = [[UIBarButtonItem alloc] initWithCustomView:myCustomView];
[buttons addObject:homeButton];
[tools setItems:buttons animated:NO];
于 2013-05-17T09:59:21.363 回答
0

您根本无法使用常规的UINavigationBar.

您必须将“显示主视图”按钮放在其他地方 - 例如在UIToolbar详细视图的底部。

或者您可以编写自己的 NavigationController 和 NavigationBar,但这需要更多的工作。:)

于 2012-11-26T10:40:55.633 回答