I checked the stack overflow questions here and I do it the same way, but still returns NULL
In the first view
in firstviewcontroller.h I have
@property (nonatomic, copy) NSString *Astring;
in firstviewcontroller.m
#import "SecondViewController.h" ... @synthesize Astring = _Astring; ... - (IBAction)filterSearch:(id)sender { NSlog(@"%@",Astring) }
at secondviewcontroller.m
#import firstviewcontroller.h ... ... FirstViewController *controller = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil]; controller.Astring = @"YES";
So, I make the variable in the firstviewcontroller and pass the variable to the secondviewcontroller in the second view, but it always returns NULL ...
Am I wrong in my logic or is it something else
source share