A UIActivity class for sharing images to Instagram.
iOS 6 introduced the new UIActivityViewController, which presents sharing options like Facebook and Twitter (as well as printing and copying). I wanted to adapt this for CatPaint, which currently uses ShareKit for sharing. My current Instagram sharer stopped working in iOS 6, and I figured now would be a good time to implement Instagram sharing using this new technique.
Usage is simple:
DMActivityInstagram *instagramActivity = [[DMActivityInstagram alloc] init];
NSArray *activityItems = @[self.imageView.image, @"CatPaint #catpaint", [NSURL URLWithString:@"http://catpaint.info"]];
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:@[instagramActivity]];
[self presentViewController:activityController animated:YES completion:^{}];
Hopefully this code will be helpful for other people implementing their own UIActivity sharers, and getting Instagram support in to their apps.
I would love if someone took an axe to the visual design of the resizer view. It’s not my best work (especially on iPad it looks funny).
The resizer view is only needed if your app creates non-square images.
This is not in use in a shipping app yet, but it will be soon.