ios - Container view transitions between UITableViewController and UIViewController, why are the bounds messed up? -
i trying implement flip between 2 view controllers embedded container view. in real app, flip button swaps between map , list.
in mockup of problem, coffee uitableviewcontroller swapped out sweets uiviewcontroller.

it works fine in simple case, when add segue sweets controller go child uiviewcontroller, things go awry after following actions - flip - segue - - flip. repeat actions , tableview makes way down off screen.

the code in flipviewcontroller is:
@interface flipviewcontroller () @property (strong, nonatomic) uiviewcontroller *controller1; @property (strong, nonatomic) uiviewcontroller *controller2; @property (strong, nonatomic) uiviewcontroller *currentviewcontroller; @end @implementation flipviewcontroller - (void)viewdidload { [super viewdidload]; self.controller1 = [self.childviewcontrollers firstobject]; self.currentviewcontroller = self.controller1; uistoryboard *storyboard = [uistoryboard storyboardwithname:@"storyboard" bundle:nil]; self.controller2 = [storyboard instantiateviewcontrollerwithidentifier:@"sweets controller"]; [self addchildviewcontroller:self.controller2]; } - (ibaction)flip:(id)sender { if (self.currentviewcontroller == self.controller1) { [self transitionfromviewcontroller:self.controller1 toviewcontroller:self.controller2 duration:0.3 options:uiviewanimationoptiontransitionflipfromright animations:nil completion:^(bool finished) { [self.controller2 didmovetoparentviewcontroller:self]; self.currentviewcontroller = self.controller2; }]; } else { [self transitionfromviewcontroller:self.controller2 toviewcontroller:self.controller1 duration:0.3 options:uiviewanimationoptiontransitionflipfromright animations:nil completion:^(bool finished) { [self.controller2 didmovetoparentviewcontroller:self]; self.currentviewcontroller = self.controller1; }]; } } @end some debugging seems indicate bounds of uitableview getting confused upon return. have autolayout problem or approach transitionfromviewcontroller: wrong way go getting effect? suggestions appreciated, i've been stuck on bug long!?
Comments
Post a Comment