I've been following Stanford's iPhone programming course on iTunes U (which, btw, I can recommend to all beginning iPhone programmers), and in one of the lectures, it is explained that it is possible for a UITableViewController to display a different view than a UITableView. This is what I wanted to implement in my app, but I can't get it to work quite right, even though I pretty much copied what occurred to me was the key to making it work.
That is part of the viewDidLoad of the class that inherits from UITableViewController. I expected to see a UITableView when that view appears, but all I'm getting is a blank screen. When I switch views (from UITableView to MKMapView), the MKMapView correctly comes up, so I don't think there's anything wrong with the piece of code that does that. If I then switch back to UITableView, I get the blank screen again.
Anybody who can point me in the right direction?
Code:
self.mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
mapView.hidden = YES;
self.tableView.frame = self.view.bounds; // this line doesn't make a difference, I can leave it out and have the same results
self.view = [[UIView alloc] init];
[self.view addSubview:self.tableView];
[self.view addSubview:self.mapView];
That is part of the viewDidLoad of the class that inherits from UITableViewController. I expected to see a UITableView when that view appears, but all I'm getting is a blank screen. When I switch views (from UITableView to MKMapView), the MKMapView correctly comes up, so I don't think there's anything wrong with the piece of code that does that. If I then switch back to UITableView, I get the blank screen again.
Anybody who can point me in the right direction?