SJ Reddy
SJ Reddy

Reputation: 577

UITableView navigation

I am working on a app, where I got a tabbar, in the 2nd tabitem, I got a UITableView, when the user presses the row on that UITableView it must navigate to another UITableView(2nd), once on the 2nd UITableView we can then navigate to detailview. Can anyone help me out how to sort this out. Help much appreciated.

- (void)viewDidLoad {
    UITabBarController * t = [[UITabBarController alloc] init];
    ResourcesViewController * c = [[ResourcesViewController alloc] init];
    UINavigationController * n = [[UINavigationController alloc] initWithRootViewController:c];
    [c release];
    NSArray * tabs = [NSArray arrayWithObject:n];
    [n release];
    [t setViewControllers:tabs];
    [window addSubview:[n view]];

    //---initialize the array---
    listOfResources = [[NSMutableArray alloc] init];

    //---add items---
    [listOfResources addObject:@"Speeches"];
    [listOfResources addObject:@"Publications"];
    [listOfResources addObject:@"Images/Photo Library"];
    [super viewDidLoad];
}

This is ViewDidLoad method in the rootviewController and I created the next level UITableView called detailtableviewcontroller but can't call it from this method.

Upvotes: 0

Views: 388

Answers (2)

James Bedford
James Bedford

Reputation: 28962

I think you might want the following view hierarcy (and corresponding controllers) to deal with this:

UITabBarController
        UINavigationController
                UITableViewController
                UITableViewController
                DetailViewController
        AnotherViewControllerForTabBarButton

Your UITabBarController switches between views one indentation level below it, one of these views will be the UINavigationController which will provide the navigation between your various table views that you describe (1 and 2), as well as the detail view once you've drilled far enough down.

Hope that helps! :)

Upvotes: 1

Related Questions