I just started to learn objective-C and am having issues with transitioning between loading a view (directly) to using a XIB as rootViewController. Currently I am trying to load my xib file into a view controller object. While it compiles without any problem, my simulator comes up blank (except for basic interface, time and battery fuel gauge). I also made sure to set my XIB into class BNRReminderViewController and set the view and respective button/objects. (I also imported my class BNRReminderViewController.h to my .m file)
Below is my code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
NSBundle *appBundle = [NSBundle mainBundle];
BNRReminderViewController *rvc = [[BNRReminderViewController alloc] initWithNibName:@"BNRReminderViewController" bundle:appBundle];
self.window.rootViewController = rvc;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
I think what is happening is that my BNRReminderViewController.xib file is not within the mainBundle so when I init with the NSBundle object nothing loads which is why I am getting blank screen. I am new to objective-C so I do not really know how to deal with this as many other languages just import a .h or directly read the file. please help.