iOS Photo Editing Controls With A Custom Camera Overlay

This is one of those blog posts that’s basically for me and anyone else who cares to Google these search terms, so yeah.

I’m currently working on an app that does camera capture. Instead of using the normal Apple control, I’m using a custom overlay. Typically to do this, you do two things: set the UIImagePickerController’s “allowsEditing” to YES and add your overlay view to the controller’s “cameraOverlayView” view. Oh, and you also set the sourceType to UIImagePickerControllerSourceTypeCamera, obviously.

I learned through searching about 10 StackOverflow questions and doing my own testing that the custom photo editing control only shows up when you show the normal apple camera controls. So unless you want to do some weird hacking to get your overlay to show up over the normal controls and then have them disappear when the photo is taken, it’s not possible to use a custom overlay and still get the built in photo editing tool.

Unless someone wants to correct me…

The annoying part is this is not captured in Apple’s official documentation (or anywhere, really). So hopefully this blog post helps someone who is trying to use a custom overlay and the built-in Apple photo cropping tool.

Mapskrieg iPhone/iPad App Launch!

It’s been about 4 years since I announced the launch of Mapskrieg, my Google Maps and craigslist mashup web app. Since then, I’ve gone to school (again), worked for Microsoft and quit, and made a few apps. Today, I’m happy to announce the launch of my newest app, Mapskrieg for iOS!

I’ve been working on this app for a few weeks, and I think it’s ready for public consumption. It’s basically Mapskrieg, but developed natively for the iPhone and iPad. In the past, I’ve taken a sort of iterative approach of releasing fairly minimal apps and improving on them. For example, I released Threadless as an iPhone only app and later added the iPad support. I wanted to release Mapskrieg on both platforms so the launch would have a little more bang. Plus I think the iPad app is the better of the two, and I really wanted that one to stand out for the release. I’ve been getting much more comfortable with mobile development, and I’m very happy with the rate at which I was able to conceive and release this app.

That’s not to say I didn’t struggle or learn anything new with it. While a lot of the concepts are borrowed from my Threadless iPad app, I had to do a lot of stuff I hadn’t done before. For example, since Mapskrieg is going to rely on iAds to make money, I decided that both the iPad and iPhone versions would support iAd. Apple, in their infinite wisdom, made the split view controller a very useful and now, standard, design paradigm. Unfortunately, they don’t provide any support for using it with iAd at all. What the fucking fuck, Apple!? So I had to basically recreate the Split View (well, the landscape mode at least) in order to support iAds. It’ll be well worth it if I can rake in some iAd dough, though!

This post also comes almost 1 year after I quit my job at Microsoft. That milestone probably deserves its own post, but I’ll just say that I have not yet regretted my decision in the very least so far. This is as fun as it gets, folks!

Edit: Oh, I forgot to link to a demo video that I recorded for a contest. Check it out in case you don’t have an iOS device:

Note to Myself about UISplitViewController and Auto-Rotation

In order to prevent my future self from wasting like, 2 hours fucking around with UISplitViewController getting it to auto-rotate its subviews, here’s a little post!

Most of the time, UISplitViewController doesn’t want to rotate because you didn’t set it as the root subview of the Window. This is pretty well documented on StackOverflow, etc. I thought this was why my splitviewblahblahblah wasn’t rotating. It turns out that, according to Apple’s documentation,

A split view controller relies on its two view controllers to determine whether interface orientation changes should be made. If one or both of the view controllers do not support the new orientation, no change is made. This is true even in portrait mode, where the first view controller is not displayed. Therefore, you must override the shouldAutorotateToInterfaceOrientation: method for both view controllers and return YES for all supported orientations.

The key here is that the view controller wasn’t autorotating because the subviews did not answer “YES!!!” (exclamation points added by me) to shouldAutoRotateToInterfaceOrientation. I was fucking around with the Split View Controller in Interface Builder (and later programmatically) to no avail. Adding the stupid autorotate thing to yes in the subviews made it work (shouldn’t it default to YES!?!??!).

Okay, lesson learned. Just don’t forget this next time, Hung!

ObjTweet: Helper Class for Twitter on iOS

I’ve been working on a new app (I’ll write more about it in a week or so), part of which required opening a user’s Twitter client with a pre-populated tweet or opening Twitter on a particular user’s profile for easy following. There are a lot of Twitter clients out there, so it’s hard to predict what a particular user will have installed on their device. They might not even have any Twitter client installed.

Many (but not all) Twitter clients have url schemes that allow you to open them with a particular message filled out, etc. There’s a few here, but it’s not a definitive list by any means. I gathered a bunch of the more popular ones and wrapped them in a helper class called ObjTweet.

Since I want to give back (and I wouldn’t mind the recognition), I’ve licensed this class under the GNU GPL license MIT License (thanks, Marcello for pointing out that the GPL license is pretty restrictive) and uploaded it to Github. Hopefully someone else finds it useful. My hope is also that people will help find some of the missing url schemes for other apps and build on ObjTweet. If you found this class and are using it, let me know! Hopefully it works as described.