[Solved] Access Data Variable from one class in another class


In SecondViewController.h

@property (nonatomic, copy) NSString *textblah;

In FirstViewController.m

#import "SecondViewController.h"

// where you want to store value

SecondCiewController *secondViewController = [[SecondViewController alloc] init];
secondViewController.textblah = stringToStore;

// and 
[self.navigationController push:secondViewController animated:YES];

// You can log the set value with to check whether it was successful or not.
NSLog(@"textblah: %@", textblah);

For complete understanding of the code and process you can watch the video tutorial like this and this

You will find them informative and easy to understand specially beginners.

5

solved Access Data Variable from one class in another class