objective c - iOS Dismiss and Present view controller custom animation -
i have view controller presenting following objective c code:
catransition *animation=[catransition animation]; animation.delegate=self; animation.duration=0.3; animation.type=kcatransitionmovein; animation.subtype=kcatransitionfromright; [self presentviewcontroller:reader animated:no completion:nil]; [reader.view.layer addanimation:animation forkey:@"animation"];
and dismissing similar code inside delegate method
catransition *animation=[catransition animation]; animation.delegate=self; animation.duration=0.3; animation.type=kcatransitionmovein; animation.subtype=kcatransitionfromleft; [self dismissviewcontrolleranimated:no completion:nil]; [self.view.layer addanimation:animation forkey:@"animation"];
however there 1 problem: unlike using navigation controller see 1 view slide onto other view; here old view disappears instantly new view moves onto blank view.
how fix problem? need code work in ios 6,7 , 8 , horizontal animation see when going , forth between views inside navigation controllers.
edit: solution accepted has bug ios 6, if can find solution fixes it, i'll edit post.
edit 2: found it. appears since presenting zbar view controller need use code
zbarcontroller.wantsfullscreenlayout=no;
after set cameraoverlayview.
presenting view controller using custom animation:
catransition* transition = [catransition animation]; transition.duration = 0.3; transition.type = kcatransitionmovein; transition.subtype = kcatransitionfromright; [self.navigationcontroller.view.layer addanimation:transition forkey:kcatransition]; [self.navigationcontroller pushviewcontroller:reader animated:no];
dismissing view controller using custom animation:
catransition* transition = [catransition animation]; transition.duration = 0.3; transition.type = kcatransitionreveal; transition.subtype = kcatransitionfromleft; [self.navigationcontroller.view.layer addanimation:transition forkey:kcatransition]; [self.navigationcontroller popviewcontrolleranimated:no];
Comments
Post a Comment