androniennn
androniennn

Reputation: 3137

prepareForSegue never called

I'm using SWRevealViewController to build a side bar menu. I have that method to select the right controller when selecting an element from the menu(UITableView). The segue identifiers/names are configured in the storyboard.

- (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender
{
    NSLog(@"Tapped");
    // Set the title of navigation bar by using the menu items
    NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
    UINavigationController *destViewController = (UINavigationController*)segue.destinationViewController;
    destViewController.title = [[_menuItems objectAtIndex:indexPath.row] capitalizedString];

    // Set the photo if it navigates to the PhotoView
    if ([segue.identifier isEqualToString:@"showToday"]) {
        [segue destinationViewController];

    }
    if ([segue.identifier isEqualToString:@"showCountries"]) {
        [segue destinationViewController];

    }


    if ( [segue isKindOfClass: [SWRevealViewControllerSegue class]] ) {
        SWRevealViewControllerSegue *swSegue = (SWRevealViewControllerSegue*) segue;

        swSegue.performBlock = ^(SWRevealViewControllerSegue* rvc_segue, UIViewController* svc, UIViewController* dvc) {

            UINavigationController* navController = (UINavigationController*)self.revealViewController.frontViewController;
            [navController setViewControllers: @[dvc] animated: NO ];
            [self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];
        };

    }

}

But nothing happens when selecting an item from the side bar menu.What could be the problem?Thank you for helping.

Upvotes: 0

Views: 1036

Answers (1)

androniennn
androniennn

Reputation: 3137

My fault, was selecting "Accessory action" instead of "Selection Segue" "reveal view controller".

Upvotes: 2

Related Questions