Search code examples
uitableviewuinavigationcontrollerunrecognized-selector

UITableViewController UINavigationController


enter image description here

I declared a GamePicerViewController (subclass of UITableViewController) .But I got a bug in the prepareForSegue:sender: method . The console says that gamePickerViewController is a UINavigationController. Have any ideas?

I post the GamePickerViewController.h PlayerDetailsViewController.m and the console in the pic abve.


Solution

  • problem solved.

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
        if ([segue.identifier isEqualToString:@"PickGame"]) {
            UINavigationController *controller = segue.destinationViewController;
            GamePickerViewController *gamePickerViewController = [controller viewControllers][0];
            gamePickerViewController.delegate = self;
            gamePickerViewController.game = _game;
        }
    }

    I forgot the line:

            UINavigationController *controller = segue.destinationViewController;