iOS学习应用开发就业课:第7章_060:导航控制器动画

作业:


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];

}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值