UIDocumentInteractionController and UIActivityViewController both present menus for sharing images out to other networks. After hitting Instagram, you are presented with a nice modal that allows you to post to Instgram without leaving the app. My question is, how do I automatically show that modal without showing the menu?
This app called Sounds does it so I know it's possible, but I can't find any documentation online about how it's done. Here is the current code I have which shows the menu:
NSString *documentDirectory=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *saveImagePath=[documentDirectory stringByAppendingPathComponent:@"Image.ig"];
NSData *imageData=UIImagePNGRepresentation(cardImage);
[imageData writeToFile:saveImagePath atomically:YES];
NSURL *imageURL=[NSURL fileURLWithPath:saveImagePath];
UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:imageURL];
docController.UTI = @"com.instagram.exclusivegram";
docController = [self setupControllerWithURL:imageURL usingDelegate:self];
[docController presentOpenInMenuFromRect:CGRectMake(1, 1, 1, 1) inView:self.view animated:YES];
Here's the menu:

Here's what I want to automatically show:
![2]](https://i.sstatic.net/hLBK6.png)
You're able to use UIActivityViewController to show up Instagram as long there is just an UIImage inside the activity items. It won't show up if you add more items like text, url etc. This is a bad limitation made by Instagram.
Like so:
NSMutableArray *items = [NSMutableArray array];
[items addObject:[UIImage ...]];
// show view
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:items
applicationActivities:nil];
[vc presentViewController:activityVC animated:YES completion:nil];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With