In my iPhone app viewWillAppear:
gets called.
Then wiewWi开发者_运维技巧llDisAppear:
gets called.
And then viewWillAppear:
gets called again.
So what could be the reason for viewWillAppear:
to be called after viewWillDisAppear:
?
Here in my case problem is that I am setting the value for flag in "nsuser defaults" before this page loads and checking the value for the flag on current screen appears
and i am resetting the value for flag on viewWillDisappear
during the execution of viewWillAppear
of current page the cuntrol reaches to some anther page and returns to same page and flag Resets
what should I do to maintain my flag value so it reset only once on final viewWillDisAppear
?
Please Help and Suggest
Thanks
Many reasons. Simply don't rely on the order / number of calls to viewDidLoad/viewWillAppear/viewDidAppear. It's also a very bad idea to abuse "view...Disappear" as a clean-up/destructor method because it is not called in all circumstances.
It is however almost always safe to assume viewDidAppear gets called after a viewWillAppear.
The reason could be that the view reappears.
精彩评论