4
我有一個導航基於控制器的應用程序,並增加了在viewDidLoad:
我怎樣才能UIToolbar當前視圖
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?
這也假定視圖控制器被添加到'UINavigationController'。 如果工具欄被添加到視圖本身,他們需要添加一個插座到他們的視圖控制器並連接它不是嗎? –
OP顯示「我有一個基於導航控制器的應用程序」。是的,如果您手動管理自己的工具欄,那麼您必須像導航控制器一樣跟蹤它。 –
toolBar僅與我寫在RootViewController.m的'viewDidLoad'中的代碼一起添加。無插座連接。 – Hadu