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.
精彩评论