开发者

Hot to pass Values between views or classes?

开发者 https://www.devze.com 2023-01-27 06:30 出处:网络
i have a view with la开发者_StackOverflow社区bel when button pressed moves to second view controller with a picker view , i need to retrive the selected value and then to pass to first view\'s label,

i have a view with la开发者_StackOverflow社区bel when button pressed moves to second view controller with a picker view , i need to retrive the selected value and then to pass to first view's label,

i have used delegates and protocols to acheive this,

but is there any possible ways like referencing like etc to do this?


You can use a singleton class to store the selected data and then can retrieve it wherever you want. Just like you get UIApplication's instance from 'sharedApplication' method, its the same object in the memory through out the application lifecycle.

0

精彩评论

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