我有一个基于导航控制器的应用程序,并在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.