Ask about Tab Bar, viewDidLoad
My program have two tabs,
- I set init v开发者_如何转开发ariable in viewDidLoad. ( int A = 0; )
- I change A = 2 when press button.
- 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 .)
I think -viewWillAppear
delegate method is more suitable for what you want - try to set your variable there.
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..
精彩评论