views:

165

answers:

2

I have a MKMapView with annotations on it and it works fine. I have a search bar as part of my navigation bar. When a user clicks on the search bar field I wanted to bring up a UITableView in code. I create a UITableView in the initialisation and want to add it to the sub view when - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar; gets called.

This all works fine but im trying to add it using [self.view addSubview:tableView] and nothing shows up. I've only ever made table views using UITableViewController so I'm a bit lost.

Thanks

A: 

I'd suggest creating a UITableViewController to control it, and then using presentModalViewController:animated: to show the tableview.

Sastira
I have considered this but I have read a few articles saying that you should avoid this method because it is limiting. The Maps app also presents the data in this way so I would like to try it.
Rudiger
A: 

This was actually correct. I was just initialising it wrong not setting the bounds for it.

Rudiger