弹出窗口中的UIToolbar [英] UIToolbar in a popover
问题描述
是否可以在弹出框内的UIViewController中显示工具栏项目?我在视图控制器的viewDidLoad方法中执行此操作:
Is it possible to show toolbar items in a UIViewController inside a popover? I'm doing this in the viewDidLoad method of my view controller:
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil];
[self setToolbarItems:[NSArray arrayWithObject:addButton]];
[addButton release];
然后,我将此视图控制器包装在 UINavigationController $ c中$ c>(具有
toolbar
属性,根据文档,我应该使用 setToolbarItems
UIViewController
的方法将其添加到工具栏),然后将其显示在弹出窗口中。
Then I'm wrapping this view controller in a UINavigationController
(which has a toolbar
property, and according to the docs, I'm supposed to use the setToolbarItems
method of UIViewController
to add items to the toolbar), then presenting it in a popover.
我看不到工具栏。使用弹出框时是否不支持工具栏?
I do not see the toolbar. Are toolbars unsupported when using a popover?
谢谢
推荐答案
显然,默认情况下工具栏是默认隐藏的,因此您必须执行以下操作:
Figured it out, apparently the toolbar is hidden by default so you have to do this:
[self.navigationController setToolbarHidden:NO animated:NO];
使其显示。
这篇关于弹出窗口中的UIToolbar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!