I have a general question about viewWillAppear, I pushed newly a view consider view1, now viewWillAppear is called for that method, if view1 pushed another view (view2). Now if view2 is popped view1’s viewWillAppear is called again, how can I come to know in which case its called i.e (is it because of newly pushing or popping of other view).
Hope my question is understandable 🙂
TIA
Frankly, I do not know how to determine that condition appropriately.
You could of course set some property of view1 in view2’s viewWillDisappear method and re-set that in view1’s viewWillAppear. Such like:
view1.m:
view2.m:
However, I strongly believe that this is not really the way you should go. Consider moving your code to the viewDidLoad method. viewDidLoad is called only once when the view(Controller) is created well before viewWillAppear is called for the first time.