社会行动片(如在iOS 6)(Social action sheet (like on iOS 6)

2019-07-03 16:07发布

关于iOS 6的一个变化是,当你想分享的东西它带来了类似于这样的动作片:

我已经看到,使用这个,有没有办法做到这一点而不进行自定义动作片原生方式的几个其他应用程序?

谢谢!

Answer 1:

    NSString *textToShare = @"your text";
    UIImage *imageToShare = [UIImage imageNamed:@"yourImage.png"];
    NSArray *itemsToShare = @[textToShare, imageToShare];
    UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil];
    activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll]; //or whichever you don't need
    [self presentViewController:activityVC animated:YES completion:nil];

见UIActivityViewController文档: https://developer.apple.com/documentation/uikit/uiactivityviewcontroller



Answer 2:

它实际上是一个自定义的动作片,你可以轻松地创建为好。 除了这个,你可能想看看这个份额套件框架。

https://github.com/ShareKit/ShareKit



文章来源: Social action sheet (like on iOS 6)