PrepareForSegue is not called in TabViewController

I have a UITabViewController that is responsible for managing multiple views (and navigation controllers). Views were linked in the Storyboard by pressing Ctrl, clicking on the UITabViewController and selecting the “segue relation” to other views.

The problem is that prepareForSegue doesn't work at all in the UITabViewController. The code did not touch anything. NSLog does not display when switching views, clicking on the tab bar.

CustomTabViewController.m

#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.

    NSLog(@"Here..");
    NSLog(@"%@", [segue destinationViewController]);
}

Does anyone know why this is happening? Thanks

+4
source share
3 answers

, UITabBarController UITabViewController, UITabBarItem prepareForSegue:sender:. , tabBarController:didSelectViewController: UITabBarControllerDelegate, , prepareForSegue:sender:. , , [segue destinationViewController] viewController.

+10

( UITabBarController) , .

, , UITabViewController. . , "UITableViewController". ( @MatteoGobbi, )

+2

, viewController, viewController UITableViewCell, UITableViewController.

performSegue didSelectRowAtIndexPath, , , UITableViewController.

EDIT:

, UITabViewController, :

segue..a UITabViewController . , , .

0

Source: https://habr.com/ru/post/1539966/


All Articles