prepareForSegue and delegates

后端 未结 2 1708
执笔经年
执笔经年 2021-02-14 08:58

I have an application with two segues. In one of the segues, the current view controller becomes a delegate and the other does not.

- (void)prepareForSegue:(UIS         


        
相关标签:
2条回答
  • 2021-02-14 09:39

    The delegate is largely irrelevant in the context of your question.

    Your first segue's destination is a navigation controller, which contains the view controller you are really interested in. Therefore to get to that view, you need to go through the navigation controller since that won't have any properties you are interested in setting.

    Your second segue goes directly to a single view controller, so you can access it directly.

    0 讨论(0)
  • 2021-02-14 09:49

    Take a look at your storyboard and it should be evident why this is the case. You have embedded MoreOptionsViewController in a UINavigationController and connected a segue to the navigation controller, thus making it the destinationViewController. This is fairly common.

    0 讨论(0)
提交回复
热议问题