I wanted to create a new view controller, which would be home view controller. However, somehow I couldn't managed to find how this exception is thrown. Having tried restarting XCode, restarting computer, clean project, delete from simulator. Nothing solved. Here are the details:
This is the exception thrown.
Xcode's Finder View is like this
The actual folder of app
The code block where nib is loaded
#pragma mark - View's life cycle
- (void)viewDidLoad
{
[super viewDidLoad];
UINib *nib = [UINib nibWithNibName:@"MainMenuCell.xib" bundle:nil];
[self.tableView registerNib:nib forCellReuseIdentifier:@"MainMenuCell"];
self.tableView.delegate = self;
}
The parent view controller of nib owner is declared
@implementation BNRAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launches
self.window.rootViewController = [[MainMenuViewController alloc] init];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
Nib's implementation file (MainMenuCell.m)
#import "MainMenuCell.h"
@implementation MainMenuCell
- (void)awakeFromNib
{
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
Reuse Identifier declared inside IB
nib's Custom Class
Copy Bundle Resources of app in Build Phases
Compiled Sources of app in Build Phases
There are too much images I apologize for that, but I've taken screenshot of everything in order to check my consistency. Any idea will be greatly welcomed (having lost like 5 hrs there!!!).
You do not need to specify the file extension in your nib loading code. Cocoa automatically handles this for you.
UINib *nib = [UINib nibWithNibName:@"MainMenuCell.xib" bundle:nil];
Should be:
UINib *nib = [UINib nibWithNibName:@"MainMenuCell" bundle:nil];