I always believe in the right tool for the job, so I’m not an Interface Builder hater per se, but I find it a little pathetic how infrequently IB is the right tool for the job. In addition, I’ve found IB to be at its worst whenever the development team is bigger than one. Don’t panic, just go nibless.
It’s very easy to go completely nibless (and a little stylish in my opinion) and eschew Interface Builder altogether. For all you Flexers out there, this is the moral equivalent of eschewing Flash Builder’s Design View. Honestly, who really uses Design View to build an app beside Adobe evangelists doing 30 minute demos?
A Completely Nibless App
Here’s how you can build a completely nibless app in five simple steps. First, you’ll want to start with a fresh Window-based Application in Xcode. Then follow these steps:
- Remove
MainWindowfrom your app’sInfo.plist - Delete all
.xibfiles - Edit
AppDelegate.hremove all theIBOutletkeywords - Edit
main.m, importAppDelegate.h, and set theUIApplicationMain‘s 4th parameter to@"AppDelegate" - Edit
AppDelegate.mto instantiate the mainUIWindowin code
Here’s what main.m should look like after you’ve completed Step 4:
#import <UIKit/UIKit.h> #import "AppDelegate.h" int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); [pool release]; return retVal; }
And here’s what the application:didFinishLaunchingWithOptions: method in AppDelegate.m should look like:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; [self.window makeKeyAndVisible]; return YES; }
Now you can go about you view-creation business in a nibless fashion. I’d probably create a UIViewController subclass as my root view, construct my UI in loadView, and wire everything together in the AppDelegate.
Nibless App Xcode Template
But don’t do any of that stuff! Instead you can just use this handy-dandy Xcode template to do all the work. On of the very few things Xcode gets right is its template system. It is very easy to create a custom template for Xcode (see here and here for the basics).
Install the NiblessApp custom template in Xcode:
- Download nibless_app_template.tgz
cd ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/(you might need to create theProject Templatesfolder if it doesn’t already exist)tar xzvf /path/to/nibless_app_template.tgz- Quit Xcode and restart
Files
- nibless_app_template.tgz – a completely nibless iPhone custom template for Xcode

Jason
9.8.2011
Thanks for writing this up. One small change – it should be screen
boundsnotframewhen initializing theUIWindow.