I have this code:
navtablecontroller = [[UITableViewController alloc] init];
navtablecontroller.tableView.delegate = self;
navtablecontroller.tableView.dataSource = self;
CGRect frame = self.view.frame;
frame.origin.y = frame.origin.y + 83.0;
frame.size.height = 200.0;
navtablecontroller.view.frame = frame;
navtablecontroller.title = @"mynameasdasd";
[self addChildViewController:navtablecontroller];
[self.view addSubview:navtablecontroller.view];
[navtablecontroller didMoveToParentViewController:self];
This perfectly creates a UITableView on the screen exactly as the frame mentioned.
Now I try to add a UINavigationController and have this UITableViewController as its RootViewController.
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:navtablecontroller];
nav.navigationBar.translucent = NO;
And then to add this as my childViewController I do:
[self addChildViewController:nav];
[self.view addSubview:nav.view];
[nav didMoveToParentViewController:self];
Unfortunately instead of creating a UINavigationController in the small frame mentioned in the code, the entire screen is replaced by the UINavigationController.
I just need that small frame to have the UINavigationController with the UITableView as its rootviewcontroller and not the entire screen. Any sugestions?
Got the solution. One has to set the frame of the UINavigationController to the frame of the UITableViewController.
Where frame is the frame of the UITableViewController.