ios - how to have a UIViewCojntroller that is instantiated out of a Storyboard be embedded within a UINavigationController -
ios - how to have a UIViewCojntroller that is instantiated out of a Storyboard be embedded within a UINavigationController -
i have uiviewcontroller called "yellow" in storyboard i'm adding this:
_detailvc = [self.storyboard instantiateviewcontrollerwithidentifier:@"yellow"]; _detailvc.location=cell.location; self.incomingview = _detailvc.view; [self addchildviewcontroller:_detailvc]; [self.view addsubview:self.incomingview]; self.incomingview.alpha = 0; [_detailvc didmovetoparentviewcontroller:self];
i need uiviewcontroller exist within uinavigationcontroller i'm using force segue , giving me next error:
*** terminating app due uncaught exception 'nsgenericexception', reason: 'could not find navigation controller segue 'pushdetailvc'. force segues can used when source controller managed instance of uinavigationcontroller.'
if go view "yellow" view controller, , "embed in navigation controller", still same problem.
how embed uiviewcontroller in uinavigationcontroller force segue works correctly?
when instantiate view controller storyboard, don't automatically controller might embedded in. you're telling scheme give detailvc, , that's gives you. if want navigation controller, need instantiate it, , automatically instantiate rootviewcontroller (which yellow) because hooked relationship segue.
uinavigationcontroller *nav = [self.storyboard instantiateviewcontrollerwithidentifier:@"nav"]; _detailvc = (detailvc *)nav.topviewcontroller; // replace detailvc whatever class name _detailvc.location=cell.location;
ios ios7 uinavigationcontroller
Comments
Post a Comment