我試圖從iPad顯示UIActionSheet
。下面是我使用的代碼:iPad UIActionSheet - 不顯示最近添加的按鈕
-(void) presentMenu {
UIActionSheet *popupMenu = [[UIActionSheet alloc] initWithTitle:@"Menu" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:nil];
for (NSString *option in _menuItems) {
[popupMenu addButtonWithTitle:option];
}
popupMenu.actionSheetStyle = UIActionSheetStyleBlackOpaque;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
[popupMenu showFromTabBar:_appDelegate.tabBar.tabBar];
}
else if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[popupMenu showFromBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES];
}
[popupMenu release];
return;
}
程序的iPhone版本顯示_menuItems
所有的按鈕,但iPad版本剛剛從數組忽略了最後一個項目。有誰知道爲什麼會發生這種情況?
謝謝,
Teja。
有多少項目在'_menuItems'有哪些? – matsr