문제

I was wondering if there is a way to reload a view controller inside one tab from another tab. This is my scenario

  1. Tab controller has 2 or more tabs
  2. Tab 1 has a view controller which has views created based on some conditions
  3. Tab 2 is a settings page, where some app settings can be changed
  4. How can i reload content inside tab 1 when settings in tab 2 are changed?

IS there something like tab bar -> tab -> view controller -> reload viewDidLoad?

Thanks

도움이 되었습니까?

해결책

The general way I solve this problem is by having a "Settings"-type object (Model) that is observed by my view controllers. In your case, you'd initialize it in your app delegate, pass it along to the view controllers for Tab 1 and Tab 2, which would then use KVO to observe it. You'd also directly modify it in Tab 2's view controller.

You could also use a NSNotifcation to signal a change in the settings to any view controller that wants to observe it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top