objective c - Unable to pass data between MasterVC to DetailVC in iOS -
i'm trying pass data(_claimreporttodetailview)
viewdidload
(of mastervc
) detailvc
. it's null
.
@interface lamasterviewcontroller () { nsarray *_claimreports; } - (void)viewdidload { [super viewdidload]; _claimreports = [[ladatamodelcontroller getsingleton] getclaimreportsorderedbyaccesseddate]; ladetailviewcontroller *detailviewcontroller = [[ladetailviewcontroller alloc] init]; detailviewcontroller.claimreporttodetailview = (laclaimreport *)_claimreports[0]; nslog(@"claim%@",detailviewcontroller.claimreporttodetailview); // captures here properly. } @interface ladetailviewcontroller : uiviewcontroller @property(nonatomic ) laclaimreport *claimreporttodetailview; @end - (void)viewdidload { [super viewdidload]; nslog(@"sdfdf%@", _claimreporttodetailview); // logs null always. }
your viewdidload
seems strange. have line:
ladetailviewcontroller *detailviewcontroller = [[ladetailviewcontroller alloc]init];
yet view controller on storyboard.
i think happening creating vc, , setting it's property, storyboard loading new vc, haven't set property.
usually, way pass information vcs on storyboards in prepareforsegue:
method.
Comments
Post a Comment