iphone – 如何进入当前视图的UIToolbar

前端之家收集整理的这篇文章主要介绍了iphone – 如何进入当前视图的UIToolbar前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个基于导航控制器的应用程序,并在viewDidLoad中添加了一些带代码的工具栏项:

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

现在我想用[UIActionSheet showFromToolbar:]显示一个actionSheet,我想要一个UIToolbar *,我怎样才能得到我之前创建的UIToolbar?

解决方法

我假设你的意思是“当前视图控制器”.在这种情况下,您需要self.navigationController.toolbar.

猜你在找的Xcode相关文章