maybe complex way of wording it.
the process of should happen:
- firstviewcontroller loads
- you click button presents new view
partial curl - you select uitablecell
- you set property in
firstviewcontrollerof whatever cell has been clicked on - in callback method in
firstviewcontrolleraccess property determine next phase of execution.
however when setting property , attempting retrieve it, coming being null. here how attempting set it:
firstviewcontroller.h:
@interface firstviewcontroller : uiviewcontroller { nsstring *navoption; } @property(nonatomic, retain) nsstring *navoption; firstviewcontroller.m ( callback ):
@synthesize navoption; -(void)callbackfornav{ nslog(@"inside callback: %@", navoption); } inside secondviewcontroller:
firstviewcontroller *dw = [[firstviewcontroller alloc] initwithnibname:nil bundle:nil]; dw.navoption = @"filter results"; i expect in callback navoption equal filter results, outputting being null. ideas have gone wrong?
if understand right have firstviewcontroller presented secondviewcontroller on top of that. problem see assigning of navoption in code secondviewcontroller created new firstviewcontroller, not referencing old one. when pop stack , go original firstviewcontroller data wasn't set on because different instance.
now see trying class properties, i'm not sure if right approach , should focus on getting reference original view controller , set property there.
if want class "property" you'll have this.
// myclass.h @interface myclass { } +(nsobject*) theobject; // myclass.m +(nsobject*) theobject { static nsobject* staticobject = nil; if (staticobject == nil) { // create object } return staticobject; }
Comments
Post a Comment