ios - How to use a UIImagePickerController with UINavigationController -
i've browsed different similar questions here couldn't find useful problem. i'm struggling quite simple can't figure out.
i'm using xcode 4.6.2 , storyboarding. here storyboard:
here workflow i'd have:
- taping on cell in tablevc should push edit document view , offer , done buttons.
- taping on camera picture should "load" (push/modal?) cameravc subclass of uiimagepickercontroller. i've added custom overlay on top of picker , use custom button take picture. on event perform segue leading previewdocumentview (modally presented) , when "use" button tapped present edit document view.
problem edit document view not have navigation bar if try set property self.navigationbarhidden = no;
seems normal me though since i've presented views modally how then?
i tried pushing cameravc tablevc error saying stacking 2 navigationcontrollers prohibited (since cameravc subclass of uiimagepickercontroller subclass of uinavigationcontroller). seems option present cameravc modally don't know how present edit document vc navigation bar.
edit: having navigation bar in cameravc not optimal acceptable if way of doing it.
it appear best solution use unwind segue!
in summary:
1)in tablevc create method such as
- (ibaction)unwindtothisviewcontroller:(uistoryboardsegue *)unwindsegue { nslog(@"rolled back"); }
2)create unwind segue previewdocumentvc , give unique id such "unwindfrompreview", connecting unwindtothisviewcontroller
ibaction. check answer gave in past detailed steps on how achieve (steps 2 , 3).
3)create prepareforsegue
method in previewdocumentvc set tablevc bool property, such
-(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@"unwindfrompreview"]) { ((tablevc*)segue.destinationviewcontroller).shouldtransitiontoeditdocvc = yes; } }
4) in tablevc's viewwillappear
method check shouldtransitiontoeditdocvc
, if set yes perform segue editdocvc.
i hope helps!
Comments
Post a Comment