Sending MMS and Email from within app
How does one get the pop up menu selection for email, mms etc which is used when an image is selected on the iphone.
Another thing, How can one add things to this menu e.g. facebook share, t开发者_C百科witter share? What is the name of this menu?
This menu is called a UIActionSheet and you write the code that determines what is presented yourself. Essentially you handle the tap through an actionHandler and then you can use the code below to present the menu. You can obviously enter your own NSString for Facebook, Twitter, etc.
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];
You are also able to register for a delegate notification to handle which button is tapped using UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
精彩评论