Reputation: 103
In my case, I am using two view controller VC1
and VC2
. Here, VC1 button click to Present Modally
and Over Full Screen
presentation with Cross Dissolve
Transition to presenting VC2. Now, from VC2 dismiss then I didn’t get call VC1 viewWillAppear()
.
I am not using code base for Present model. I am using Storyboard Segue
.
Why it happening and how to fix this?
Upvotes: 1
Views: 885
Reputation: 734
Change presentation to Full screen
or If you want to stick to Over Full Screen
then make vc2 delegate of vc1 and call delegate method on dismiss.
To understand the concept you can refer to : https://medium.com/livefront/why-isnt-viewwillappear-getting-called-d02417b00396
Upvotes: 1
Reputation: 3157
From Docs,
Note
If a view controller is presented by a view controller inside of a popover, this method is not invoked on the presenting view controller after the presented controller is dismissed.
So according to the documentation when a ViewController presents another ViewController modally this method will not be called. To fix this you need to use
func dismiss(animated flag: Bool,
completion: (() -> Void)? = nil)
and move(or repeat) some of viewWillLoad logic to completion handler.
Upvotes: 1