ios - Problems dismissing and representing UIImagePickerController camera iOS8.4 -


edit problem reinstated scratch.

i have viewcontroller a has navigation bar button presents uiimagepickercontroller of sourcetype uiimagepickercontrollersourcetypecamera, we'll call viewcontroller b. in didfinishpickingmediawithinfo: method of a, present viewcontroller c.

the problem starts here. when reach c, can see view stack clearly:

a -modal-> b -modal-> c

from c have "back" button present on navigation bar should take me b. however, since b uiimagepickercontroller, cannot reuse , must dismissed. so, make happen, have following method executing "back" button on c:

- (ibaction)backonpost:(uibarbuttonitem *)sender {     [self.view endediting:yes];      uinavigationcontroller *logcontrol = [self.storyboard instantiateviewcontrollerwithidentifier:@"logcontrol"];     rglogviewcontroller *logview = (rglogviewcontroller *)logcontrol.topviewcontroller;      [uiview animatewithduration:0.25 animations:^{          self.presentingviewcontroller.view.alpha = 0;         [self.presentingviewcontroller dismissviewcontrolleranimated:no completion:nil];         [self.presentingviewcontroller.presentingviewcontroller dismissviewcontrolleranimated:no completion:nil];     } completion:^(bool finished){         [logview setboolbackpushed];     }]; } 

the above code works in takes me a dismissing b , c. however, can still see transition because of bit of "black-screening" dismissal of 2 viewcontrollers. can see in completion block [logview setboolbackpushed];, sets static bool variable true beginning of a's viewwillappear: presents new uiimagepickercontroller - method looks this:

- (void)viewwillappear:(bool)animated {     nslog(@"heres postbackbuttonpushed:%hhd", postbackbuttonpushed);      if(postbackbuttonpushed == true)     {         self.view.hidden = yes;         self.navigationcontroller.navigationbar.hidden = yes;         self.tabbarcontroller.tabbar.hidden = yes;          uiimagepickercontroller * imagepicker = [[uiimagepickercontroller alloc] init];         imagepicker.sourcetype = uiimagepickercontrollersourcetypecamera;         imagepicker.delegate = self;         [self presentviewcontroller:imagepicker animated:no completion:^{}];     } 

this how getting following desired effect: go a camera (b), c , new camera our new b. achieved w/ perfect seamless transitions.

im still having problems being able see transitions. problem timing. collaboration of dismissing , presenting viewcontrollers takes more time to. it's instantaneous, better. should , doing wrong?

there possible cases cause problem :

  1. presenting b after , presenting c bit strange behaviour both ux/ui , code. either push b , present c on b or dismiss a, present b, dismiss b, present c.

  2. there completion methods , not using them. code show call dismissviewcontrolleranimated twice c , b ex. should handle presenting , dismissing order. think ios 8.2+ or 8.3+ start handle them more efficiently. , if there error, crash after version.

  3. imagepicker controller cause error while dismissing vcs in different ways. ex. showing alert popup before presenting vc can cause crash.


Comments