For some reason my nib wont load after the homeButton is pressed. However, the NSLogs are executed properly.
- (IBAction)homePressed:(id)sender {
NSLog(@"hi");
[[NSBundle mainBundle] loadNibNamed:@"rewardViewController" owner:self options:nil];
NSLog(@"hey");
}
Anyone know what’s wrong with this code?
thanks!
There is nothing syntactically wrong with your code, but I suspect that you may have misunderstood what loadNibNamed is going to do for you. If you are trying to change screens by loading a new nib file then you want to explore UINavigationController.
Your code would look something more like this:
If you really did intend to use loadNibNamed like you have above you need to assign it to something to make it useful. For example if your nib contains an instance of a UIViewController you might do something like this:
This would create a new instance of a UIViewController with the contents of your nib file. You could then do whatever it is that you wanted to with that UIViewController.