作业:
1.新建2个页面,从ViewFirst(主页),ViewSecond,
2.两个页面到:导航控制器
3.First到Second的页面,用3D翻转效果
rippleEffect
cube 3D效果
moveln(movein)
reveal 向左移动
fade(default)
pageCurl
pageUnCurl
suckEffect 水文
ripple
olgFlip
源码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//创建窗口
self.window=[[UIWindowalloc] initWithFrame:[UIScreenmainScreen].bounds];
//创建导航控制器动画
View02 *vc=[[View02alloc]init];
UINavigationController* nav=[[UINavigationControlleralloc]initWithRootViewController:vc];
vc.title=@"控制器一";
self.window.rootViewController=nav;
nav.navigationBar.translucent=NO;
[self.windowmakeKeyAndVisible];
return YES;
}
ViewFirst页面
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view.
_imageView=[[UIImageViewalloc]init];
_imageView.frame=CGRectMake(40,40, 200,200);
_imageView.image=[UIImageimageNamed:@"1.jpg"];
[self.viewaddSubview:_imageView];
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
//定义一个动画变换对象,层动画对象
//类方法获取动画对象
CATransition* amin=[CATransitionanimation];
//设置动画的时间
amin.duration=3;
//决定动画的效果形式
amin.type=@"cube";
//设置动画的子类型,例如动画的方向
amin.subtype=kCATransitionFromLeft;
amin.timingFunction=[CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseIn];
//将动画设置对象添加到动画上
[self.navigationController.view.layeraddAnimation:amin forKey:nil];
//创建控制器2
View03 *vc03=[[View03alloc]init];
//推出到前台显示
[self.navigationControllerpushViewController:vc03 animated:YES];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
CATransition *ami=[CATransition animation];
ami.duration=1;
ami.type=@"cube";
ami.subtype=kCATransitionFromRight;
//ami.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
[self.navigationController.view.layer addAnimation:ami forKey:nil];
[self.navigationController popViewControllerAnimated:YES];
}