Xcode社交媒体分享按钮

时间:2012-08-24 00:59:47

标签: objective-c xcode twitter social-networking facebook-social-plugins

是否有适用于Xcode的内置api /代码,允许应用程序检测iphone / ipad / ipod touch中安装的其他社交媒体应用程序以填充共享功能?

有人告诉我Android有这样的功能,iOS也有吗?

3 个答案:

答案 0 :(得分:5)

Twitter集成内置于iOS 5中,请查看此链接http://developer.apple.com/library/ios/documentation/Twitter/Reference/TWTweetSheetViewControllerClassRef/Reference/Reference.html

对于Facebook,您需要使用Facebook SDK,请点击此处http://developers.facebook.com/docs/reference/iossdk/

或者您可以尝试使用ShareKit ... http://getsharekit.com/

或GetSocialize ...... http://www.GetSocialize.com/

这两项都会降低功能。

答案 1 :(得分:1)

- (IBAction) shareHasTapped: (id)sender {

    NSString *texttoshare = @"text to share";

    //  UIImage *imagetoshare = [UIImage imageNamed:@"beck.png"];

    NSArray *activityItems = @[texttoshare];

    UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];

    activityVC.excludedActivityTypes =@[UIActivityTypeCopyToPasteboard, UIActivityTypePostToWeibo, UIActivityTypePostToTwitter, UIActivityTypePostToWeibo];


[self presentViewController:activityVC animated:TRUE completion:nil];

}

答案 2 :(得分:0)

使用UIActivityViewController分享图像社交网络:

- (无效)shareimage {

NSArray *objectsToShare = @[_s_image];
UIActivityViewController * avc = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];

avc.excludedActivityTypes=@[UIActivityTypePostToTwitter];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
    [self presentViewController:avc animated:YES completion:nil];
}
else
{
    UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:avc];
    [popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}

}