ios - instantiateViewControllerWithIdentifier and pass data -


i using storyboard in app , want pass data 1 view view.

instead of using segues using instantiateviewcontrollerwithidentifier. in case instantiate first tableviewcontroller navigationcontroller has second tableviewcontroller attached because need navigation in second tableviewcontroller. want pass data first tableviewcontroller, depending row clicked, second tableviewcontroller. in case newtopviewcontroller navigationcontroller problem how pass data firsttableviewcontroller secondtableviewcontroller.

 - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath     {         nsstring *identifier = [nsstring stringwithformat:@"%@top", [menuarray objectatindex:indexpath.row]];           uiviewcontroller *newtopviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:identifier];         } 

enter image description here

if instantiate navigationcontroller, can use viewcontrollers property inner viewcontroller of navigation controller.

something this:

uinavigationcontroller *navigationcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:identifier]; mbfancyviewcontroller *viewcontroller = navigationcontroller.viewcontrollers[0];  // setup "inner" view controller viewcontroller.foo = bar;  [self presentviewcontroller:navigationcontroller animated:yes completion:nil]; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -