ios - Change RootViewcontroller with the Push Transition effect -
in ios app need alter rootviewcontroller of window in between of app .so when alter rootviewcontroller dyncamically flicking view before change.but want give smooth transition when rootviewcontroller changed.
i had tried next not transition want.
[uiview transitionwithview:self.window duration:.8 options:uiviewanimationoptiontransitioncurlup animations:^{ self.window.rootviewcontroller = tabbarcontrollermain; [self.window makekeyandvisible]; } completion:null];
i want specific transition navigationcontroller pushview transition.
can body give me thought how accomplish that?
based on apple's documentation
uiviewcontroller *viewcontrollertobeshown=[[uiviewcontroller alloc]init]; //viewcontrollertobeshown.view.frame = self.view.frame; viewcontrollertobeshown.view.backgroundcolor = [uicolor orangecolor]; appdelegateclass *yourappdelegate =(appdelegateclass*)[uiapplication sharedapplication].delegate; uiview *myview1 = yourappdelegate.window.rootviewcontroller.view; uiview *myview2 = viewcontrollertobeshown.view; myview2.frame = yourappdelegate.window.bounds; [yourappdelegate.window addsubview:myview2]; catransition* transition = [catransition animation]; transition.startprogress = 0; transition.endprogress = 1.0; transition.type = kcatransitionpush; transition.subtype = kcatransitionfromright; transition.duration = 5.0; // add together transition animation both layers [myview1.layer addanimation:transition forkey:@"transition"]; [myview2.layer addanimation:transition forkey:@"transition"]; myview1.hidden = yes; myview2.hidden = no; yourappdelegate.window.rootviewcontroller = viewcontrollertobeshown;
ios iphone objective-c uiviewanimationtransition
No comments:
Post a Comment