开发者

Ask about Tab Bar, viewDidLoad

My program have two tabs,

  1. I set init v开发者_如何转开发ariable 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 .)


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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜