ios - Push parameter in controller is always null -


i'm having tableview. , in didselectrow right object want pass next controller.

this code:

 id<navigatedelegate> strongdelegate = self.delegate;     nsdictionary * dictionary = [_dataarray objectatindex:indexpath.section];     nsarray * array = [dictionary objectforkey:@"data"];     poi * poi = [array objectatindex:indexpath.row];     nslog(@"%@", poi);     nslog(@"category %@", poi.rank.name);      [tableview deselectrowatindexpath:indexpath animated:yes];      detailsviewcontroller * detailscontroller = [[detailsviewcontroller alloc] init];     detailscontroller.details = [[nsdictionary alloc] initwithobjectsandkeys:poi.name, @"name", poi.address, @"address", poi.details, @"details", poi.title, @"title", poi.url, @"url", nil];      if ([strongdelegate respondstoselector:@selector(navigatefromto:to:)]) {         [strongdelegate navigatefromto:self to:detailscontroller];     } 

then in delegate receiver push controller like:

- (void) navigatefromto:(poitableviewcontroller *)viewcontroller to:(uiviewcontroller *)tocontroller {     [self.navigationcontroller pushviewcontroller:tocontroller animated:yes]; } 

but still detailscontroller details nsdictionary null.

what doing wrong?

i found problem. viewdid load called before setter called.

so changed init method this:

-(instancetype) initwithpoi:(nsdictionary *) poi {     self = [super init];     if(self)     {         nslog(@"init detailsviewcontroller");         _details = poi;         [self initializeviews];     }     return self; } 

that way controller has poi details start.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -