Guest User

Untitled

a guest
Jan 17th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. UIImage *instaImage = [UIImage imageNamed:@"imagetoShare.png"];
  2.  
  3. NSString* imagePath = [NSString stringWithFormat:@"%@/image.igo",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
  4. NSUserDomainMask, YES) lastObject]];
  5.  
  6. [[NSFileManager defaultManager] removeItemAtPath:imagePath error:nil];
  7.  
  8. [UIImagePNGRepresentation(instaImage) writeToFile:imagePath atomically:YES];
  9.  
  10. UIDocumentInteractionController *_docController = [UIDocumentInteractionController interactionControllerWithURL:
  11. [NSURL fileURLWithPath:imagePath]];
  12.  
  13. _docController.UTI = @"com.instagram.exclusivegram";
  14.  
  15. [_docController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
Add Comment
Please, Sign In to add comment