How to add custom buttons to UIActivityViewController?

感情迁移 提交于 2019-12-19 03:14:32

问题


I am using UIActivity in ios7. It is working fine with a few lines of code. Now i want to add instagram share button to it. Is there a way to add custom buttons to the action sheet?

This is how i am creating the UIActivityViewController:

NSString *textToShare = self.navigationItem.title;    
NSArray *itemsToShare = @[textToShare, [imagesArray objectAtIndex:afImgViewer.currentImage]];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard,    UIActivityTypeAssignToContact]; //or whichever you don't need
[self presentViewController:activityVC animated:YES completion:nil];

回答1:


Well you have to create your own custom UIActivity, in your case for Instagram.

Have a look at this, even if the question is about on how to do it on iOS 6, the solution is exactly the same on iOS 7.

You can also have a look at this project on github, basically is a collection of custom UIActivity for the most common services Instagram included.



来源:https://stackoverflow.com/questions/20029520/how-to-add-custom-buttons-to-uiactivityviewcontroller

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