开发者

Global object sharing between 2 views

开发者 https://www.devze.com 2023-01-02 07:52 出处:网络
I have created a project using Utility Application. It creates 2 views, one mai开发者_如何学JAVAn and one flipview. How can i declare a global variable in main so that i can access it in flipview cont

I have created a project using Utility Application. It creates 2 views, one mai开发者_如何学JAVAn and one flipview. How can i declare a global variable in main so that i can access it in flipview controller too?


If I recall correctly, the flipside view controller is created by the main view controller in the Utility template. If these are the only view controllers you use in your app, you can easily pass data to and from the flipside view controller by adding properties and/or init methods.

However, if you must use a global variable, here's an article that discusses the various methods:

Cocoa with Love: Singletons, AppDelegates and top-level data.

0

精彩评论

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