views:

277

answers:

0

Hello,

I have a view. I want to put one UINavigationController and one UITableView in this view and display data from database into my TableView.

  1. I put a UINavigationController in my instance window.

  2. In the View part of this NavigationController I drag and drop a UITableView.

  3. I map the File Owner->Identity Inspector->Class with the ViewController (.h and .m) class file created which is inherited with UIViewController and supports delegates. In this .m file I am writing my code for UITableView like numberOfRowsInSection and cellForRowAtIndexPath.

  4. I am having two Outlets in this file: mainNavController which I connect with the UINavigationController of step 1 and tableView Outlet which I connect with the UITableView in the step 2. I connect the dataSource and the delegate of the tableView with the File Owner.

  5. In my AppDelegate class I display this view as:

    TournamentListController *tempViewController = [TournamentListController alloc]; tempViewController = [tempViewController initWithNibName:@"TournamentList" bundle:[NSBundle mainBundle]]; self.cntrlTournamentListController = tempViewController; [tempViewController release];

    [window addSubview:[self.cntrlTournamentListController view]];

  6. In the viewDidLoad method I write following code:

[self.view.window addSubview:mainNavController.view];

Still I am not able to achieve what I want