I am new to objective c and I guess it has to do with me not understanding pointers or something, but I cannot access a variable outside the class it was declared in.
I know this is a ridiculous question, but I need help.
I have something as simple as an NSString which depending on which tablecell row is selected it grabs the name and stores it in the string. The thing is , I need this string available in another class where the file needs to be loaded using String value. I just get a string is nul or nil whatever error.
I have tried property, synthesize, imports, @class but I guess I dont know what the true meaning of those things are.
Please point me in the right direction.
In libraryTableViewController I declare
NSString *fileToLoad;
@property (nonatomic, retain) NSString *fileToLoad;
in the .m I @synthesize fileToLoad;
then in the didSelectRowAtIndexPath
method I fileToLoad = @"%@", [categories objectAtIndex:row];
The problem is in another view controller class I want to load from tableViewData plist
NSString *myFile = [[NSBundle mainBundle] pathForResource:fileToLoad ofType:@"plist"];
but just get nil; ?