ios - Creating transitions on the navigation stack that show both source and destination views? -
the native push transition shows source view, , transition on destination view seamlessly.
the modal transition shows destination view overlaying source view bottom.
i'd modal transition works navigation controller.
so far have this:
cabasicanimation *anim = [cabasicanimation animationwithkeypath:@"transform.translation.y"]; anim.duration = .2; anim.autoreverses = no; anim.removedoncompletion = yes; anim.fromvalue = [nsnumber numberwithint:sourceviewcontroller.view.frame.size.height]; anim.tovalue = [nsnumber numberwithint:0]; [sourceviewcontroller.navigationcontroller.view.layer addanimation:anim forkey:kcatransition]; [sourceviewcontroller.navigationcontroller pushviewcontroller:destinationcontroller animated:no];
this in -perform
method in segue subclass. problem navigation controller push done immediately, , while transition takes place, nothing of source view displayed. want if it's overlaying.
i thought might possible take screenshot using core graphics , having superview of destination view, couldn't work properly.
i tried using 1 of uiview
animation methods so:
[sourceviewcontroller.view addsubview:destinationcontroller.view]; [destinationcontroller.view setframe:sourceviewcontroller.view.window.frame]; [destinationcontroller.view settransform:cgaffinetransformmaketranslation(0, sourceviewcontroller.view.frame.size.height)]; [destinationcontroller.view setalpha:1.0]; [uiview animatewithduration:1.3 delay:0.0 options:uiviewanimationoptiontransitionnone animations:^{ [destinationcontroller.view settransform:cgaffinetransformmaketranslation(0, 0)]; [destinationcontroller.view setalpha:1.0]; } completion:^(bool finished){ [destinationcontroller.view removefromsuperview]; [sourceviewcontroller.navigationcontroller pushviewcontroller:destinationcontroller animated:no]; }];
but again, there's issue this: navigation bar isn't displayed until view controller pushed onto navigation stack. there's sort of "jump" @ end of animation when navigation bar displayed.
so options this?
i resolved taking route of creating image of source view , transitioning on that.
also, should noted "flash" doesn't exist on ios 7 there isn't custom code necessary.
Comments
Post a Comment