I want to create a Tableview in a Tab bar application.
Because I’m using the new version of Xcode (Xcode 4.2) I cannot view the “MainWindow.xib” to place a navigation controller there. I have viewed another question where it said to insert the following code in “App Delegate.m”
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UITableViewController *viewController3 = [[ParkTable alloc] initWithNibName:@"ParkTable" bundle:nil];
UIViewController *viewController4 = [[TableView alloc] initWithNibName:@"TableView" bundle:nil];
UINavigationController *navController1 [[[UINavigationController alloc] initWithRootViewController:viewController4]];
self.tabBarController = [[UITabBarController alloc] init];
self.ParkTableDel = [[UITableViewController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, viewController3, viewController4, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
I inserted this code an received an error stating “Size of array has non-integer type ‘UINavigationController *’
I was wondering if anyone could tell me what i have done, and/or point me towards a tutorial that shows how to insert a TableView with navigation controller into a tab based application programatically or a tutorial showing how to get the “mainWindow.xib” in Xcode 4.2.
Any Help would be appreciated as I have hit a brick wall.
Your code should work. You just forgot a ‘=’.
Try this: