在iOS中的Instagram上与图像共享文本 [英] Share text with Images on Instagram in ios

查看:159
本文介绍了在iOS中的Instagram上与图像共享文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我在Instagram上共享图像.在我的应用程序中运行良好.

In my App I sharing an image on Instagram. It is working well in my app.

我正在使用以下代码.

@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;
}

现在我也想与图像共享一些文本.

Now I also want to share some text with the image.

如下图所示.在写标题"中,我想要一些默认的自定义文本,例如. 分享这张照片".

As shown in the Image below. In " Write a Caption", I want some default custom text for eg. "Share this photo".

我该怎么做?

预先感谢...

已编辑

我正在从我的应用程序打开Instagram,以共享图像,并且效果很好.

I am opening Instagram from my app for sharing images and it works fine.

但是我是否可以检查用户是否已成功共享它?

But Is it possible that Can I check Whether the user has shared it successfully or not?

意味着当用户成功共享图像时,我想在数据库中执行一些操作.

Means I want to perform some action in my DB when user successfully shares an image.

我该怎么做?

推荐答案

我得到了答案.刚刚添加一行,它对我有用.

I got my answer. Just added a line and it worked for me.

self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];

谢谢...

这篇关于在iOS中的Instagram上与图像共享文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆