How to set the delegate with a storyboard

前端 未结 3 554
被撕碎了的回忆
被撕碎了的回忆 2020-12-05 07:56

I\'ve been debating with this for a while now, hope you can help me.

I\'ve been creating an app using storyboards mostly, I have a point where I popup a modal box to

3条回答
  •  心在旅途
    2020-12-05 08:38

    Basically you need to create an
    Instance of UINavigationController and assign destinationViewController to it
    and grab its topView controller

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
        if ([[segue identifier] isEqualToString:@"showAdd"]) {
    
        UINavigationController *navigationController = segue.destinationViewController;
        AddDrinkViewController *addDrinkcontroller = (AddDrinkViewController *)navigationController.topViewController;
    
        addDrinkcontroller.delegate = self;
    
       }
    }
    

提交回复
热议问题