领英Google+ UIActivity视图控制器按钮? [英] LinkedIn & Google+ UIActivity View Controller Button?
问题描述
我了解到有一个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];
然后实现GooglePlusActivityType
和LinkdInActivityType
的类,以将数据加载到两个站点.
Then implement classes for both GooglePlusActivityType
and LinkdInActivityType
to handle loading the data to the two sites.
这篇关于领英Google+ UIActivity视图控制器按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!