Xcode 6 und iOS 8 Apps ohne Storyboards

Veröffentlicht am 28.10.2014

Wer seine iOS 8 App ohne Storyboards programmieren möchte kann dazu einfach in einer frischen Single View Application das Haupt-Storyboard Main.storyboard löschen. Weiterhin sollte das entsprechende Key Value Paar aus der Info.plist entfernt werden:

<key>UIMainStoryboardFile</key>
<string>Main</string>

Danach kann innerhalb der Implementierung des AppDelegates ein Hauptfenster mit einem dazugehörigen initialen ViewController erzeugt werden:

@interface AppDelegate ()

@end

@implementation AppDelegate

@synthesize window = _window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    
    _window = [[UIWindow alloc] initWithFrame:screenBounds];
    
    MyViewController* viewController = [[MyViewController alloc] init];
    [_window setRootViewController:viewController];
    
    _window.backgroundColor = [UIColor whiteColor];
    
    [_window makeKeyAndVisible];
    
    return YES;
}

...