views:

108

answers:

2

My program have two tabs,

  1. I set init variable in viewDidLoad. ( int A = 0; )
  2. I change A = 2 when press button.
  3. I switch to tab2 and switch back to tab1, A is still 2.

How to call viewDidLoad in tab1 again ? ( I want to init variable again when switch back to tab1 .)

+1  A: 

Without knowing much, i could say, You should organize your data better way!

Tabbar viewcontrollers wont be loaded again while switching! You can handle ViewWillAppear though..

Prakash
+1  A: 

I think -viewWillAppear delegate method is more suitable for what you want - try to set your variable there.

Vladimir