Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ViewDidAppear and ViewWillAppear is being called multiple times on one viewDidLoad in ios swift app [duplicate]

I am making iPhone app on swift,here ViewDidAppear and ViewWillAppear is being called multiple times on one viewDidLoad in ios swift app?

please help me.

like image 465
sulabh qg Avatar asked Dec 21 '25 19:12

sulabh qg


1 Answers

Whenever You push a viewController, It will call viewDidLoad then viewWillAppear and last viewDidAppear. But if you are coming back to viewController only viewWillAppear and viewDidAppear will call.

View will call these two (viewWillAppear & viewDidAppear) every time, whenever this viewController shows on every condition

i. On push - viewDidLoad after it, viewWillAppear & viewDidAppear.

ii. On back or pop - No viewDidLoad will call, Only viewWillAppear & viewDidAppear.

iii. On become active state - No viewDidLoad will call, Only viewWillAppear & viewDidAppear.

like image 86
Mohit Tomar Avatar answered Dec 24 '25 08:12

Mohit Tomar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!