开发者

UIToolbar in a popover

开发者 https://www.devze.com 2023-01-05 19:25 出处:网络
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:

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 arrayWi开发者_Python百科thObject:addButton]];
    [addButton release];

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?

Thanks


Figured it out, apparently the toolbar is hidden by default so you have to do this:

[self.navigationController setToolbarHidden:NO animated:NO];

To make it appear.

0

精彩评论

暂无评论...
验证码 换一张
取 消