开发者

globle variable

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜