FunctorPrototype
FunctorPrototype

Reputation: 1203

Exception while trying using UITabBarController with UITableViewController in iOS

I'm newbie. I'm trying to use UITabBarController with UITableViewController (without UINavigationController), but I've faced with exception after modifying std tabbar project

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "IHHideView" nib but didn't get a UITableView.'

My didFinishLaunching

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    UIViewController *hideViewController = [[IHHideViewController alloc] init];
    UIViewController *unhideViewController = [[IHUnhideViewController alloc] init];
    UIViewController *filesVIewController = [[IHFilesViewController alloc] init];
    self.tabBarController = [[UITabBarController alloc] init];
    self.tabBarController.viewControllers = @[hideViewController,unhideViewController,filesVIewController];
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    return YES;
}

IHHideViewController just simplesubclass of UITableViewController

@interface IHHideViewController : UITableViewController

@end

As I know UITableViewController create own UITableView object with the correct dimensions and autoresize mask if not to specify nib file. Why such exception occurs?

Upvotes: 1

Views: 100

Answers (2)

FunctorPrototype
FunctorPrototype

Reputation: 1203

Hmmm recreating project using empty template solve problem.

Upvotes: 0

Abdullah Shafique
Abdullah Shafique

Reputation: 6918

It is because you are sub-classing a TableViewController. Instead change:

@interface IHHideViewController : UITableViewController

to:

@interface IHHideViewController : UIViewController

Upvotes: 1

Related Questions