[英]Share text with Images on Instagram in ios
在我的應用程序中,我在Instagram上共享圖像。 在我的應用程序中運行良好。
我正在使用以下代碼。
@property (nonatomic, retain) UIDocumentInteractionController *dic;
CGRect rect = CGRectMake(0 ,0 , 0, 0);
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIGraphicsEndImageContext();
NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/test.igo"];
NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", jpgPath]];
// NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]];
self.dic.UTI = @"com.instagram.photo";
self.dic = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
[self.dic presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate {
UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL: fileURL];
interactionController.delegate = interactionDelegate;
return interactionController;
}
現在,我還想與圖像共享一些文本。
如下圖所示。 在“寫標題”中,我想要一些默認的自定義文本,例如。 “分享這張照片”。
我怎樣才能做到這一點?
提前致謝...
已編輯
我正在從我的應用程序中打開Instagram,以共享圖像,並且效果很好。
但是,是否可以檢查用戶是否已成功共享它?
意味着當用戶成功共享圖像時,我想在數據庫中執行一些操作。
我怎樣才能做到這一點?
我得到了答案。 剛剛添加一行,它對我有用。
self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];
謝謝...
它也記錄在http://instagram.com/developer/iphone-hooks/的官方文檔中
要在照片中包含預填充的標題,可以在文檔交互請求上將注釋屬性設置為NSDictionary,該NSDictionary在鍵“ InstagramCaption”下包含NSString。 注意:此功能將在Instagram 2.1及更高版本上可用。
您不再被允許與Instagram或Facebook分享預填文本。
只能通過UIDocumentInteractionController共享圖像/屏幕截圖。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.