开发者

How can I get to UIToolbar of the current view

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜