I have a UITabBarController which has on one of its tabs, a UINavigationController. The UINavigationController then has a custom UIViewController as its main view.
Based on an IBAction triggered by a button in the custom UIViewController I'm pushing a UITableView controller onto the UINavigationController stack like so. (Note: these are only snippets of the actual code).
Header file for main UIViewController:
@interface ATMs : UIViewController <CLLocationManagerDelegate, NSFetchedResultsControllerDelegate, MKMapViewDelegate> {
}
- (IBAction) showLocationList;
@end
Implementation file for main UIViewController:
@implementation ATMs
- (void)showLocationList {
LocationList *locationTableController = [[LocationList alloc] initWithNibName:@"LocationList" bundle:nil];
[self.navigationController pushViewController:locationTableController animated:YES];
[locationTableController release];
}
The locationTableController view controller does a fetch to Core Data for a list of objects and displays them on the table. When a user selects a row, I want the following things to happen:
- pop the
locationTableControlleroff the navigation controller so that myATMsview controller is visible - call a method in
ATMs, passing in the object represented by the row tapped inlocationTableController
I tried to do this by using the [locationTableController setDelegate:self]; in showLocationList just beneath where I alloc the UITableViewController and adding the UITableViewDelegate to the header for ATMs.
But when I do the above, I get a build error saying that locationTableController may not respond to setDelegate.