ios - Why does data give me null? -


i'm trying pass nsdictionaryfrom tableviewcontrollerto viewcontroller. in tableviewcontroller.m. have code navigate viewcontroller:

- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     nsdictionary *objectdict = [dataarray objectatindex:indexpath.row];     nslog(@"info: %@", objectdict);     // pass object new page     //uiviewcontroller * vc = [[uiviewcontroller alloc] init];     //[self presentviewcontroller:vc animated:yes completion:nil];      seeinfovc *controller = [[seeinfovc alloc] init];     controller.data = objectdict;      nsstring * storyboardname = @"main";     uistoryboard *storyboard = [uistoryboard storyboardwithname:storyboardname bundle: nil];     uiviewcontroller * vc = [storyboard instantiateviewcontrollerwithidentifier:@"seeinfovc"];     [self presentviewcontroller:vc animated:yes completion:nil]; 

in viewcontroller.h have:

@interface seecardvc : uiviewcontroller {     nsdictionary *data; } @property (nonatomic, retain)nsdictionary *data;   @end 

and i'm trying log data in viewcontroller.m:

@implementation seecardvc @synthesize data;  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view.     nslog(@"info: %@", data);  } 

but gives me null :( doing wrong?

let's see code doing here:

// create new controller, assign objectdict data property seeinfovc *controller = [[seeinfovc alloc] init]; controller.data = objectdict;  //get storyboard name nsstring * storyboardname = @"main"; //get storyboard (btw, can self.storyboard) uistoryboard *storyboard = [uistoryboard storyboardwithname:storyboardname bundle: nil]; //instantiate new controller uiviewcontroller * vc = [storyboard instantiateviewcontrollerwithidentifier:@"seeinfovc"]; //present new controller [self presentviewcontroller:vc animated:yes completion:nil]; 

you created controller , assigned data it, , didn't use anymore, instead created new 1 storyboard, didn't add data , presented it.

basically, created two, set data 1 , presented other one.

see problem?


Comments