ios - Custom Storyboard Segue -
i have custom storyboard segue animation not coming out way want to. instead of "wiping" in on view controller, want "push" away current view controller new 1 next it. (not push segue, more the effect seen in photos app when swipe through photos). ideas? thanks.
- (void)perform { uiviewcontroller *currentviewcontroller = self.sourceviewcontroller; uiviewcontroller *newviewcontroller = self.destinationviewcontroller; [currentviewcontroller.view addsubview:newviewcontroller.view]; newviewcontroller.view.transform = cgaffinetransformmakescale(0.05, 0.05); cgpoint originalcenter = newviewcontroller.view.center; newviewcontroller.view.center = self.originatingpoint; [uiview animatewithduration:1.9 delay:0.0 options:uiviewanimationoptioncurveeaseinout animations:^{ newviewcontroller.view.transform = cgaffinetransformmakescale(1.0, 100.0); newviewcontroller.view.center = originalcenter; } completion:^(bool finished){ [newviewcontroller.view removefromsuperview]; // remove temp super view [currentviewcontroller presentviewcontroller:newviewcontroller animated:no completion:null]; // present vc }]; }
animations:^{ newviewcontroller.view.transform = cgaffinetransformmakescale(1.0, 100.0); newviewcontroller.view.center = originalcenter; }
it looks you're not animating current view controller's view. i'm not sure why you're setting transform of new view controller's view. i'd expect code this:
cgpoint originalcenter = currentviewcontroller.view.center; cgpoint newcurrentvccenter = cgpointmake(currentviewcontroller.view.center.x - screenwidth, currentviewcontroller.center.y); [uiview animatewithduration:1.9 delay:0.0 options:uiviewanimationoptioncurveeaseinout animations:^{ currentviewcontroller.center = newcurrentvccenter; newviewcontroller.view.center = originalcenter; } completion:^(bool finished){ // clean here }];
in other words, you're moving currentviewcontroller.view
, newviewcontroller.view
, current view , new view both shift left same amount , @ same time.
Comments
Post a Comment