社交动作表(如iOS 6) [英] Social action sheet (like on iOS 6)

查看:76
本文介绍了社交动作表(如iOS 6)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS 6上的变化是,当您要共享某些内容时,它会显示类似于以下内容的操作表:

on iOS 6 a change was that when you want to share something it brings up an action sheet similar to this:

我还看到了其他一些使用此功能的应用程序,是否有一种本机方式可以执行此操作而无需创建自定义操作表?

I have seen a few other apps that use this, is there a native way to do this without making a custom action sheet?

谢谢!

推荐答案

    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

See UIActivityViewController documentation: https://developer.apple.com/documentation/uikit/uiactivityviewcontroller

这篇关于社交动作表(如iOS 6)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆