是否有任何 Xcode 的内置 api/代码允许应用程序检测 iphone/ipad/ipod touch 中安装的其他社交媒体应用程序以填充共享功能?
听说安卓有这样的能力,iOS也有吗?
是否有任何 Xcode 的内置 api/代码允许应用程序检测 iphone/ipad/ipod touch 中安装的其他社交媒体应用程序以填充共享功能?
听说安卓有这样的能力,iOS也有吗?
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/
这两者都提供了功能下降。
- (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];
}
使用 UIActivityViewController 共享图像社交网络:
-(无效)共享图像{
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];
}
}