在App中实现iPhone主屏那样手指滑动翻页效果的代
以下这段youke分享的代码,能让您的App实现类似iPhone主屏幕那样的手指划动翻页效果,注意将代码中的coming和going换成想要的项。 [UIView beginAnimations:@View Flip context:nil]; [UIView setAnimationDu
以下这段“youke”分享的代码,能让您的App实现类似iPhone主屏幕那样的手指划动翻页效果,注意将代码中的“coming“和”going”换成想要的项。
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
UIViewController *coming = [[UIViewController alloc] init];
UIViewController *going = [[UIViewController alloc] init];
UIViewAnimationTransition transition;
coming.view = self.view.superview;
going.view = self.view;
transition = UIViewAnimationTransitionCurlUp;
//[UIView setAnimationTransition:transition forView:self.view cache:YES];
[UIView setAnimationTransition:transition forView:self.view.superview cache:YES];
[coming viewWillAppear:YES];
[going viewWillDisappear:YES];
[going.view removeFromSuperview];
[going viewDidDisappear:YES];
[coming viewDidAppear:YES];
[UIView commitAnimations];
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
UIViewController *coming = [[UIViewController alloc] init];
UIViewController *going = [[UIViewController alloc] init];
UIViewAnimationTransition transition;
coming.view = self.view.superview;
going.view = self.view;
transition = UIViewAnimationTransitionCurlUp;
//[UIView setAnimationTransition:transition forView:self.view cache:YES];
[UIView setAnimationTransition:transition forView:self.view.superview cache:YES];
[coming viewWillAppear:YES];
[going viewWillDisappear:YES];
[going.view removeFromSuperview];
[going viewDidDisappear:YES];
[coming viewDidAppear:YES];
[UIView commitAnimations];