Note that there are some explanatory texts on larger screens.

plurals
  1. POInstagram open UTI directly
    text
    copied!<p>I recently stumbled upon the following interesting feature: <a href="http://instagr.am/developer/iphone-hooks/" rel="noreferrer">Instagram iPhone Hooks</a></p> <p>I was wondering if one is able to open an app through the documentinteractioncontroller immediately, <strong>WITHOUT</strong> having to show a preview (– presentPreviewAnimated:) or an action sheet (– presentOpenInMenuFromRect:inView:animated:). Seems to me that it's the only way, but I might be missing something. </p> <pre><code>-(void) saveToInstagram { NSURL *url; UIDocumentInteractionController *dic; CGRect rect = CGRectMake(0 ,0 , 0, 0); UIImage *i = imageView.image; CGRect cropRect = CGRectMake(i.size.width - 306 ,i.size.height - 306 , 612, 612); NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test.ig"]; CGImageRef imageRef = CGImageCreateWithImageInRect([imageView.image CGImage], cropRect); UIImage *img = [[UIImage alloc] initWithCGImage:imageRef]; CGImageRelease(imageRef); [UIImageJPEGRepresentation(img, 1.0) writeToFile:jpgPath atomically:YES]; url = [[NSURL alloc] initFileURLWithPath:jpgPath]; dic = [self setupControllerWithURL:url usingDelegate:self]; [dic presentOpenInMenuFromRect:rect inView:self.view animated:YES]; [dic retain]; [img release]; [url release]; } - (UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL usingDelegate: (id &lt;UIDocumentInteractionControllerDelegate&gt;) interactionDelegate { UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL: fileURL]; interactionController.delegate = interactionDelegate; return interactionController; } - (void)documentInteractionControllerWillPresentOpenInMenu:(UIDocumentInteractionController *)controller { } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload