i trying make custom segue between 2 view controllers. works fine, except @ end of animation can see source viewcontroller flashing brief moment (very short). doesn't happen every time.
.h file:
#import <uikit/uikit.h> @interface horizontalsegue : uistoryboardsegue @property cgpoint originatingpoint; @end .m file:
#import "horizontalsegue.h" @implementation horizontalsegue - (void)perform { uiviewcontroller *sourceviewcontroller = self.sourceviewcontroller; uiviewcontroller *destinationviewcontroller = self.destinationviewcontroller; // add destination view subview, temporarily [sourceviewcontroller.view addsubview:destinationviewcontroller.view]; // store original centre point of destination view cgpoint originalcenter = destinationviewcontroller.view.center; // set center start point of button destinationviewcontroller.view.center = cgpointmake(self.originatingpoint.x*3, self.originatingpoint.y); [uiview animatewithduration:0.5 delay:0.0 options:uiviewanimationoptioncurveeaseinout animations:^{ destinationviewcontroller.view.center = originalcenter; } completion:^(bool finished){ [destinationviewcontroller.view removefromsuperview]; // remove temp super view [sourceviewcontroller presentviewcontroller:destinationviewcontroller animated:no completion:null]; // present vc }]; } @end is there way rid of flash? have tried of solutions presented similar problems, nothing works.
you not suppose show viewcontroller that, adding subviews of destination current 1 , making animatinos them. there lot of logic involved when transitioning 1 controller sdk needs do, important follow apple guides.
since ios7.0 there complete new way show controller animations via uiviewcontrollertransitioningdelegate (which @property of uiviewcontrollers) lets kind of animations.
there plenty of tutorials
http://www.teehanlax.com/blog/custom-uiviewcontroller-transitions/
if however, want keep old way of embedding controllers manually, should check "add , removing child" here: https://developer.apple.com/library/ios/featuredarticles/viewcontrollerpgforiphoneos/creatingcustomcontainerviewcontrollers/creatingcustomcontainerviewcontrollers.html
Comments
Post a Comment