How can I add a “share” option to an iOS/iPhone or Android image gallery?

谁说胖子不能爱 提交于 2019-12-23 04:12:26

问题


I'm trying to add either a "share" option to iOS or Android phone galleries, or else another menu option that will perform the same task. I would like to start with iOS if it is possible. For example, if you go to your image gallery on an iPhone or Android phone, there is a share button, and you can choose Email, Picasa, Facebook, Twitter, etc depending on the phone. I need to add something like that to share it to my own web site or app.

If anyone has an idea of even a starting point to start reading that would be helpful!


回答1:


on iOS, you can use ShareKit:

ShareKit : Drop-in Share Features for all iOS Apps

on Android, use ACTION_SEND:

Sharing content in Android using ACTION_SEND Intent




回答2:


From iOS 6, you can use this approach:

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:^{}];

But on iOS 5, Sharekit is the only way as far as i know.



来源:https://stackoverflow.com/questions/7829942/how-can-i-add-a-share-option-to-an-ios-iphone-or-android-image-gallery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!