I have taken an NSString from one class to another
I have a quiz view controller where a user enters a question in a UITextView and then they press next to go to the select friends view controller where they select a user and then send the question over parse.com
quiz.h
@property (nonatomic,strong) IBOutlet UITextView *textField;
@property (nonatomic, strong) NSString *text;
quiz.m
- (IBAction)next:(id)sender {
NSString *text = self.textField.text;
if ([text length] == 0) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error!"
message:@"Enter some text"
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
} else {
selectFriendsViewController *sfvc = [[selectFriendsViewController alloc] init];
sfvc.string = text;
}
}
selectfriendsviewcontroller.h
@property (nonatomic, retain) NSString *string;
selectfriendsviewcontroller.m
@synthezise string;
- (void)viewDidLoad {
[super viewDidLoad];
quizViewController *qvc = [[quizViewController alloc] init];
qvc.text = string;
UITextView *textfield = [[UITextView alloc] init];
string = textfield.text;
}
why does the string show null?? in the quiz.m when i press next the string passes as null, any ideas as to how i can fix?