领英Google+ UIActivity视图控制器按钮? [英] LinkedIn & Google+ UIActivity View Controller Button?

查看:103
本文介绍了领英Google+ UIActivity视图控制器按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解到有一个Facebook& UIActivity View Controller的Twitter按钮,但是我在徘徊是否有通过UIActivityViewController共享给Google+或LinkedIn的服务?

I understand that there is a Facebook & Twitter button for the UIActivity View Controller, but I was wandering if there was a service for sharing to Google+ or LinkedIn through the UIActivityViewController?

推荐答案

apple提供的类型中没有一个可用,但是您可以创建自己的类型.您可以创建一个UIActivity类,并将其传递到UIActivityViewController中,以处理将数据发送到要与之交互的每个服务:

There is not one for each available in apple provided types, but you can create your own. You can create an UIActivity class and pass it into the UIActivityViewController to handle sending data to each of the services you are looking to interactive with:

DataItemProvider *dataToShare = [[DataItemProvider alloc] initWithPlaceholderItem:FileTypeToShare];

GooglePlusActivityType *googleActivity = [[GooglePlusActivityType alloc] init];
LinkdInActivityType *linkdinActivity = [[LinkdInActivityType alloc] init];

NSArray *activityTypes = @[googleActivity, linkdinActivity];
NSArray *activityItems = @[dataToShare];

UIActivityViewController *activityController = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:activityTypes];

[activityController setCompletionHandler:^(NSString *activityType, BOOL completed) {
    //Put in your completion handle code here.
}];

[self presentViewController:activityController animated:YES completion:nil];

然后实现GooglePlusActivityTypeLinkdInActivityType的类,以将数据加载到两个站点.

Then implement classes for both GooglePlusActivityType and LinkdInActivityType to handle loading the data to the two sites.

这篇关于领英Google+ UIActivity视图控制器按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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