Answer the question
In order to leave comments, you need to log in
How to fire a function in previous VC when dismiss is done?
There are VC1 and VC2, the transition is VC1-> VC2 presentModaly. VC2 has a back button with self.dismiss(animated: true, completion: nil) function. But with such a transition back, I need to update the label.text in VC1, the value of which I became aware of in VC2. how to do it?
Answer the question
In order to leave comments, you need to log in
There are three ways to do this (you can do more, but this is usually a perversion already).
1) Through delegates, you can easily find it in Google, I like this method the least.
2) Create a separate class (mb manager?) Singleton, in which you will save all the necessary values \u200b\u200bfor a specific entity
and in the first controller, in the ViewWillAppear method, which is called every time before the screen appears, update your label, the data that you take from that very class -manager
most often this option will be correct.
3) find your first controller in the navigation controller and assign the value from the second controller to it.
Those. with the first and second options, you should have a check outside, which everyone can change, and therefore at the right time (ViewWillAppear) you update your label with this property.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question