Search code examples
iphoneobjective-ciosxcodeviewwillappear

not call viewWillAppear while popping from view controller in iPhone


I am using iOS image gallery for selecting the image in my code
When I have done selecting image it calls the viewWillAppear method of my current class in which I have clear some variable.
So it clear the variable again which I not want.
Is there any method when the image gallery close it not calls the viewWillAppear method.
Thanks


Solution

  • The problem here is your architecture and not the way the UIView cycle works. Your question is a bit vague, so I don't fully understand the complexity of your application and so I can't provide a suitable solution to fix your problem.

    Although for a quick fix, you can do something like this:

    1) When you open your gallery, just set a BOOL to YES.

    2) When you close your gallery and you enter in viewWillAppear, just check if the BOOL is YES, if YES, then do not clear your variables.

    3) Don't forget to reset your BOOL value again to NO.