2011-02-18 84 views
0

如何在iPhone上選擇圖像時使用電子郵件,彩信等彈出式菜單選項。從應用程序內發送彩信和電子郵件

Menu

另一件事,一個人怎麼可以添加的東西到這個菜單例如Facebook分享,Twitter分享?這個菜單的名字是什麼?

回答

1

此菜單被稱爲UIActionSheet,您可以編寫代碼來確定自己顯示的內容。基本上你通過一個actionHandler處理tap,然後你可以使用下面的代碼來展示菜單。你可以明顯地輸入自己的NSString爲Facebook,Twitter等

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle: [[NSString alloc] initWithFormat: @"How should we do something?"] 
delegate: self cancelButtonTitle: @"Cancel" destructiveButtonTitle: nil 
otherButtonTitles: @"Choice 1", @"Choice 2", @"Choice 3", nil]; 

[actionSheet setActionSheetStyle: UIActionSheetStyleBlackTranslucent]; 

// we need to those this in the main view otherwise the "z-order" with the tab bar takes  precedence and "covers up" the lower half of the 
// cancel button 
[actionSheet showInView: [self view]]; 
[actionSheet release]; 

您還能夠針對受委託通知登記處理的按鈕使用UIActionSheetDelegate

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 
+0

很好,謝謝挖掘。頂部欄中的小回覆按鈕如何顯示? – jarryd 2011-02-18 08:20:39

相關問題