Reputation: 11
My app is a ViewBased app. I added a subclass of type UITableView with its .xib when i press a button i want to load the UITableView xib but it loads only the table with no Navigation bar and search bar i added. Here's the code to load the view:
- (IBAction)changeView:(id)sender;
{
TableViewController *tableview =[[TableViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:tableview animated:YES];
}
This is what I want to load:
image 1 http://img571.imageshack.us/img571/3846/wantf.png
and this is what it loads:
image 2 http://img528.imageshack.us/img528/9928/loadu.png
How can I solve the issue and load the view with nav and search bar ? Thanks in advance mates.
Upvotes: 0
Views: 170
Reputation: 828
When editing your xib file, I believe XCode gives you the option of showing/hiding your search bar.
Upvotes: 0
Reputation: 8772
You need to wrap your view controller in a UINavigationController, like this:
UINavigationController: Simplest Example
So try this:
TableViewController *tableview =[[TableViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:tableview];
[self presentModalViewController:navController animated:YES];
Upvotes: 1