2016-04-14 12 views

答えて

0

SLComposeViewControllerのような余分なテキストをInstagramやFacebookと共有することはできません。 はUIActivityViewControllerで最高になると、この答えに似activityItemsに画像を追加することができます見てhere

をお持ちのhttps://stackoverflow.com/a/32783758/1107580

0

あなたはInstagramのにアプリから写真を共有することができますどのように現時点では、2つの方法があります

  1. カメラのギャラリーに画像を保存します。 @ "instagram:// camera"を使用してInstagramアプリケーションを開きます。インスタントグラムアプリを直接開くことができます。作成された日付でソートされたウィットピクチャと、あなたのものが最初に表示されます。
  2. UIDocumentInteractionControllerを使用してアクションシートを開きます。ユーザーがInstagramでImportを選択すると、クロップから始まるInstagramの共有フローがポップアウトされます。ここで

秒オプションのXamarinのコードです:

UIImage imageToUse = _your_ui_image_instance; 
NSString documentDirectory = (new NSString(Environment.GetFolderPath(Environment.SpecialFolder.Personal))); 
string saveImagePath = documentDirectory.AppendPathComponent(new NSString(@"Image.ig")); 
NSData imageData = imageToUse.AsPNG(); 
imageData.Save(saveImagePath, true); 
NSUrl imageURL = NSUrl.FromFilename(saveImagePath); 

DocumentController = new UIDocumentInteractionController(); 
DocumentController.Url = imageURL; 
DocumentController.Uti = "com.instagram.photo"; 

DocumentController.PresentOpenInMenu(new RectangleF(1, 1, 1, 1), View, true); 

ではなく、地元の財産をPresentOpenInMenuを失うために実行されます一度(エラーが発生しますクラスのフィールドとしてDocumentControllerを宣言することを忘れないでくださいUIDocumentInteractionControllerが早すぎます)。

あなたは、代わり .igo UTI com.instagram.exclusivegramと拡張子を使用してアクションシートにずっと少ないのアプリを表示することができます。

+0

ビュー変数とは何ですか? – gianis6

+0

@ gianis6 Viewは、画面の属性である - UIViewControllerです。 – Jozef

関連する問題