Sharing information between screens in UITabBarController
I hav开发者_运维知识库e UITabBarController, containing 2 screens - A,B. I also have a strings array - strArr in my application delegate (this array is a global variable).
Screen A changes strArr. Screen B contains UIPickerView that displays the values from strArr.
The problem: When I see screen B, I can see the updated values from the strArr array in the picker. BUT, after I'm changing the values of strArr in Screen A, switching to screen B and watching the spinner, I still see the old values, and the app crashes when I'm selecting non-existing anymore item from the picker...
The question (You've probably already know what I'm about to ask..): How can I display the updated values in the picker that located on screen B?
Thanks all.
If part of your data model changes and the rest of your app needs to know about it, you can use Key-Value Observing or notifications.
精彩评论