[英]Sharing information between screens in UITabBarController
I have UITabBarController, containing 2 screens - A,B. 我有UITabBarController,包含2个屏幕-A,B。 I also have a strings array - strArr in my application delegate (this array is a global variable). 我也有一个字符串数组-我的应用程序委托中有strArr(此数组是全局变量)。
Screen A changes strArr. 屏幕A更改strArr。 Screen B contains UIPickerView that displays the values from strArr. 屏幕B包含UIPickerView,它显示strArr中的值。
The problem: When I see screen B, I can see the updated values from the strArr array in the picker. 问题:当我看到屏幕B时,可以在选择器的strArr数组中看到更新的值。 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... 但是,在屏幕A中更改strArr的值,切换到屏幕B并查看微调器之后,我仍然看到旧值,并且当我从选择器中选择不再存在的项目时,应用程序崩溃。 。
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? 问题(您可能已经知道我要问的问题了。):如何在屏幕B的选择器中显示更新的值?
Thanks all. 谢谢大家
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.