Monday, 15 April 2013

ios - Animating the transition of switching between views -



ios - Animating the transition of switching between views -

i working through beginners guide programming ios6. it's been fine until when tried animate switching , forth between 2 views. final goal of exercise have seem if each view on of other (like sides of coin/piece of paper).

however, when utilize code given in book, 1 of animations activates book says code should work both.

i have been on code multiple times create sure have done right , have not been able distinguish difference between code have , code in book. know it's simple doing (or more not doing) don't have experience find it.

any help much appreciated.

code:

- (ibaction)switchviews:(id)sender { [uiview beginanimations:@"view flip" context:nil]; [uiview setanimationduration:1.25]; [uiview setanimationcurve:uiviewanimationcurveeaseinout]; if (self.yellowviewcontroller.view.superview == nil) { if (self.yellowviewcontroller == nil) { self.yellowviewcontroller = [[bidyellowviewcontroller alloc] initwithnibname:@"yellowview" bundle:nil]; } // 1 doesn't work [uiview setanimationtransition:uiviewanimationoptiontransitionflipfromright forview:self.view cache:yes]; [self.blueviewcontroller.view removefromsuperview]; [self.view insertsubview:self.yellowviewcontroller.view atindex:0]; } else { if (self.blueviewcontroller == nil) { self.blueviewcontroller = [[bidblueviewcontroller alloc] initwithnibname:@"blueview" bundle:nil]; } // 1 works [uiview setanimationtransition:uiviewanimationtransitionflipfromleft forview:self.view cache:yes]; [self.yellowviewcontroller.view removefromsuperview]; [self.view insertsubview:self.blueviewcontroller.view atindex:0]; } [uiview commitanimations]; }

its because utilize uiviewanimationoptiontransitionflipfromright instead of uiviewanimationtransitionflipfromright

ios animation view

No comments:

Post a Comment