Using Apple icons with iOS 6

2019-02-01 01:49发布

问题:

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?

回答1:

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:

Documentation here.



回答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.



回答3:

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



标签: ios icons