ios - passing data from didSelectRowAtIndexPath to another view controller ios7 -


i trying implement slide menu, when select option, sends variable value second view controller, has query parse, updated based on selected value slide menu.

how pass variable didselectrowatindexpath view controller

menuviewcontroller.h

@property (strong, nonatomic)nsstring *passvariable; 

menuviewcontroller.m

  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {  nsstring *identifier = [nsstring stringwithformat:@"%@", [self.menu objectatindex:indexpath.row]];  uiviewcontroller *newtopviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:identifier];     _passvariable = @"fieldname";   [self.slidingviewcontroller anchortopviewoffscreento:ecright animations:nil oncomplete:^{     cgrect frame = self.slidingviewcontroller.topviewcontroller.view.frame;     self.slidingviewcontroller.topviewcontroller = newtopviewcontroller;     self.slidingviewcontroller.topviewcontroller.view.frame = frame;     [self.slidingviewcontroller resettopview]; }];  } 

secondviewcontroller.m

   nsstring *vname = menuviewviewcontroller.passvariable; 

tried above, passvariable not work in secondviewcontroller.m

you want "push" objects next viewcontroller, not pull them previous viewcontroller.

create @property (copy, nonatomic) nsstring *fieldname; in secondviewcontroller , use this:

secondviewcontroller *newtopviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:identifier]; newtopviewcontroller.fieldname = @"fieldname"; 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -