cobolero cobolero - 1 year ago 74
iOS Question

starting ios project without storyboard

Im having some troubles to start an iOS app using xibs instead of storyboard. The problem is that im getting a black screen and the first view controller is not being called (added break point to


In the app delegate header i have declared this:

@property (strong, nonatomic) UIWindow window;
@property (strong, nonatomic) ViewController *viewController;

And in the
method i have this implementation:

self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
navController.navigationBarHidden = YES;

self.window.rootViewController = navController;
[self.window makeKeyAndVisible];

Looking over some forums i found that i should be allocing the window so i added this as the first line of the function

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

The problem is that, when i do this, the app crashes after returning from
method (SIGABRT without any trace).

I also tried to make the
a property and also instantiating a default
class initing the same xib

What am i doing wrong?

Thanks and regards

Answer Source

OK, at last i got it.

What i had to do is just add again

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

After this, just delete the .h, .m and .xib and create them again.

For any reason its working fine now.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download