您的位置:首页 > 移动开发

在App中实现iPhone主屏那样手指滑动翻页效果的代

2010-05-31 14:32 911 查看
以下这段“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];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: