I am trying to pass a NSString to another view.
In my first view (is a map view) my code is:
FirstView.m file:
import “FlipsideViewController.h”
-(IBAction) displayDetails:(id) sender{
MyLocation *ann = [_mapView.selectedAnnotations objectAtIndex:([_mapView.selectedAnnotations count]-1)]; FlipsideViewController *flipsideViewController; flipsideViewController= [[FlipsideViewController alloc]init]; flipsideViewController.details =ann.name; NSLog(@"ann.name:%@", ann.name); NSLog(@"details:%@", flipsideViewController.details); FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"details" bundle:nil]; controller.delegate = self; controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:controller animated:YES]; [controller release];}
and the NSlog print the correct string. But when I try to pass that string to my SecondViewController string called details:
In my FlipsideViewController.h is defined:
NSString *details;
@property (nonatomic, strong) NSString *details;
While in the FlipsideViewController.m
@synthesize details; //and whenever I put the log, it prints the null value
value: NSLog(@”**************detalli %@”,detalli);
Where is my fault?
in the secondViewController add a property, a retained property of type NSString
For adding properties please read the following
http://cocoacast.com/?q=node/103
Please edit this section
to