13

With the release of iOS 6 I'd like to revisit the original question here: Access to Apple's built in Icons?

For example, when you hit the 'action' button to share a photo, now instead of an action sheet with buttons titled 'Message', 'Mail', etc., now there is a collection view of the icons for mail, messaging, facebook, twitter, etc.

For a 'share' action in my app I'd like to be able to present the same - because it looks better and would provide a consistent user experience. Is the use of these icons still not allowed, even if they are referring to (and would take the user to) the apps they originally belong to?

Community
  • 1
  • 1
j9suvak
  • 1,120
  • 2
  • 9
  • 14
  • Are you referring to the "Open In..." action? Because that automatically formats as a collection view in iOS 6. Or are you referring to an ActionSheet with a collection view instead of a list? – Sam Spencer Sep 22 '12 at 18:51

3 Answers3

16

For just showing the share UI with icons, you probably want UIActivityViewController.

NSString* someText = self.textView.text;
NSArray* dataToShare = @[someText];  // ...or whatever pieces of data you want to share.

UIActivityViewController* activityViewController = 
        [[UIActivityViewController alloc] initWithActivityItems:dataToShare 
        applicationActivities:nil];
[self presentViewController:activityViewController animated:YES completion:^{}];

It looks like:

Screenshot of sharing UI in iOS6

Documentation here.

Daniel
  • 23,129
  • 12
  • 109
  • 154
zpasternack
  • 17,838
  • 2
  • 63
  • 81
2

The problem with using UIActivity for sending mail is that you cannot set the subject field's text, recipients, etc. like you can with MFMailComposeViewController

I've been trying to do a workaround to set the subject field, but have not found a solution yet.

klcjr89
  • 5,862
  • 10
  • 58
  • 91
  • have you been able to add in your own icon and when pressed goes to your own IBAction in the UI Share menu? – OscarTheGrouch Oct 08 '12 at 11:53
  • Hi, yes I have! and it's very beautiful :) See my post here for how to do it: http://stackoverflow.com/questions/12766300/the-definitive-answer-for-ios-6-custom-uiactivity-and-uiactivityprovider – klcjr89 Oct 08 '12 at 13:34
1

UIActivity class provides built-in activity types for mail, messaging, ...

pronvit
  • 4,169
  • 1
  • 18
  • 27
  • Thanks - here's the documentation in case I'm not the only one who hasn't stumbled across UIActivity yet: https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIActivity_Class/Reference/Reference.html – j9suvak Sep 22 '12 at 19:04