不积跬步,无以至千里;不积小流,无以成江海

Our practice

不积跬步,无以至千里;不积小流,无以成江海

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

- (void)onSwitchViews:(id)sender  

{  

if (secondViewController == nil)  

{  

ContitionSelectorPage *tempViewController = [[ContitionSelectorPage alloc] initWithFrame: CGRectMake(0, 44, self.view.frame.size.width,  self.view.frame.size.height-44) ];                  

secondViewController = [tempViewController retain];  

[tempViewController release];  

}  

[UIView beginAnimations:@"View Flip" context:nil];  

[UIView setAnimationDuration:1.25];  

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];  

UIViewController *coming=nil;  

UIViewController *going=nil;  

UIViewAnimationTransition transition;  

if (firstViewController.view.superview == nil)   

{          

coming=firstViewController;  

going=secondViewController;  

transition=UIViewAnimationTransitionFlipFromRight;                  

}  

else  

{  

coming=secondViewController;  

going=firstViewController;  

transition=UIViewAnimationTransitionFlipFromLeft;  

}  

[UIView setAnimationTransition:transition forView:self.view cache:YES];  

[coming viewWillAppear:YES];  

[going viewWillDisappear:YES];  

[going.view removeFromSuperview];  

[self.view insertSubview:coming.view atIndex:0];  

[coming viewDidAppear:YES];  

[going viewDidDisappear:YES];  

[UIView commitAnimations];  

}  

posted on 2011-07-11 15:55  英怀  阅读(1239)  评论(0编辑  收藏  举报