我正在开发一款游戏,我想做的是在玩家死亡时使用屏幕截图并使用iOS分享图片功能上传该图片以分享到Twitter,facebook等...我将图像存储在本地。< / p>
以下是我共享图片链接的代码,但我想上传本地图片。
非常感谢任何帮助。
public void Share(int score)
{
UIViewController rootViewController = new UIViewController();
NSURL url = new NSURL("http://i.imgur.com/iWKad22.jpg");
NSData data = NSData.read(url);
UIImage image = new UIImage(data);
NSString textShare = new NSString("My Score: " + score + "! #Udderpanic");
NSArray<NSObject> textToShare = new NSArray<NSObject>(textShare, image);
UIActivityViewController share = new UIActivityViewController(textToShare,null);
((IOSApplication)Gdx.app).getUIViewController().addChildViewController(rootViewController);
if(UIDevice.getCurrentDevice().getModel().contentEquals("iPad"))
{
final UIPopoverController popoverController = new UIPopoverController(share);
popoverController.presentFromRectInView(new CGRect(0, 400, 0, 400), rootViewController.getView(), UIPopoverArrowDirection.Right, true);
}
else
{
rootViewController.presentViewController(share, true, null);
}
}