I know that this question is really old, but I'm having a lot of trouble accessing NSString's from another class;
Let's say that I have FirstViewController
and SecondViewController
, and from the Second
I want to access a NSString called string
- which is in FirstViewController
-(okay, I know it's obvious). Here's the code of the SecondViewController
:
FirstViewController *viewController = [[FirstViewController alloc] init];
NSLog(@"%@", viewController.string);
But the result is (null)
, because it's getting the value from the init
method.
Anyone have some tip/solution to access the string
from any place that it's declared?
Thanks!