开发者

globle variable

开发者 https://www.devze.com 2023-02-15 17:56 出处:网络
I have declare a variable ( int index) in delegate file of application. And also created a property for it @property (nonatomic, r开发者_C百科eadwrite) int myIndex; . Now I want to use this variable i

I have declare a variable ( int index) in delegate file of application. And also created a property for it @property (nonatomic, r开发者_C百科eadwrite) int myIndex; . Now I want to use this variable in another class . I tried but i could not assigned any value to this variable it saws '0'. and ya i have import delegate file in another file. I tried to access this variable by creating delegate's object.


You can access your property like this:

((ApplicationDelegate *)[UIApplication sharedApplication].delegate).myIndex

ApplicationDelegate should be changed to the name of your application delegate if it is different.

0

精彩评论

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