One of my biggest pet peeve when it comes to iOS is how the keyboard stays on screen by default. Basically, when you add a TextField the keyboard pops up and won’t go away. Pretty much every app out there has the keyboard dismiss if you tap outside of it. Yet the default is to leave it there.

I’ve seen a lot of different ways to deal with this but the easiest I’ve found is to add the following to the AppDelegate.

@implementation AppDelegate
// Tap outside of a text edit will dismiss the keyboard.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [self.window endEditing:YES];

This really should be part of the template when you create a new app. The really nice thing about having this here is that it work whenever a keyboard is opened in any View.