I have one .xib file with an App Delegate. In this App Delegate, I have certain instances of variables:
//The model objects
NSString* _stringWord;
NSMutableArray *_images;
int _numberOfWordsTotal;
int _numberOfWords;
Which are conveniently declared as properties:
@property (nonatomic, copy) NSString * stringWord;
@property (nonatomic) int numberOfWordsTotal;
@property (nonatomic) int numberOfWords;
@property (nonatomic, copy) NSMutableArray * images;
And synthesized in the .m file
@synthesize stringWord = _stringWord;
@synthesize images = _images;
@synthesize numberOfWordsTotal = _numberOfWordsTotal;
@synthesize numberOfWords = _numberOfWords;
In the App Delegate I do perform some operations with this variables. More specifically, I assign some images to the _images variable. The information is correctly stored, according to the debugger.
In a different .xib file, I want to access the content of this delegate. So my idea is to access the entire delegate through the use of this function:
Visual_PoetryAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
I can see that the delegate variable is instantiated, including access to all the variables. However, when it comes to deal with them, the variables are empty (the value generated in the previous .xib doesn't seem to be stored).
Any idea or suggestion? Is there any better way to access a previous delegate from a different .xib file?