开发者

How can I get to UIToolbar of the current view

开发者 https://www.devze.com 2023-04-05 11:29 出处:网络
I have a navigation controller based app, and added some toolbar items with code in viewDidLoad: NSArray* toolbarItems = [NSArray arrayWithObjects:

I have a navigation controller based app, and added some toolbar items with code in viewDidLoad:

NSArray* toolbarItems = [NSArray arrayWithObjects:
                         [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 
                                                                       target:self
                                                                       action:@selector(addButton)],
                         [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace 
                        开发者_StackOverflow中文版                                               target:self
                                                                       action:nil],
                         [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose 
                                                                       target:self
                                                                       action:@selector(composeMail)],
                         nil];
[toolbarItems makeObjectsPerformSelector:@selector(release)];
self.toolbarItems = toolbarItems;

now I want to show an actionSheet with [UIActionSheet showFromToolbar:] and I want a UIToolbar * for that, how can I get the UIToolbar that I have created earlier?


I assume you mean "of the current view controller." In that case you want self.navigationController.toolbar.

0

精彩评论

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