IOS动画

简介: IOS动画

图片移动

- (IBAction)OpenAnimation:(id)sender {
    [super viewDidAppear:YES];
    [self.image setFrame:CGRectMake(0, 0, 100, 100)];
    [UIView beginAnimations:@"xcodeImageViewAnimation" context:self.image];
    [UIView setAnimationDuration:2];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(imageViewDidStop:finished:context:)];
    [self.image setFrame:CGRectMake(100, 100, 100, 100)];
    [UIView commitAnimations];
}
- (void)imageViewDidStop:(NSString *) paramAnimationID finished:(NSNumber *)paramFinished context:(void *)paramContext
{ NSLog(@"Animation finished.");
    NSLog(@"Animation ID = %@", paramAnimationID);
    UIImageView *contextImageView = (UIImageView *)paramContext;
    NSLog(@"Image View = %@", contextImageView);
}

图片由小变大

    [super viewDidAppear:YES];
    /* Place the image view at the center
     of the view of this view controller */
    self.image.center = self.view.center;
    /* Make sure no translation is applied to this image view */ self.image.transform = CGAffineTransformIdentity;
    /* Begin the animation */
    [UIView beginAnimations:nil context:NULL];
    /* Make the animation 5 seconds long */ [UIView setAnimationDuration:5.0f];
    /* Make the image view twice as large in width and height */ self.image.transform = CGAffineTransformMakeScale(2.0f, 2.0f);
    /* Commit the animation */
    [UIView commitAnimations];

图片的旋转

  [super viewDidAppear:YES];
    self.image.center = self.view.center;
    /* Begin the animation */
    [UIView beginAnimations:@"clockwiseAnimation" context:NULL];
    /* Make the animation 5 seconds long */
    [UIView setAnimationDuration:5.0f];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(imageViewDidStop:finished:context:)];
    /* Rotate the image view 90 degrees */
    self.image.transform =CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);
    /* Commit the animation */
    [UIView commitAnimations];

多动画次序

  [UIView animateWithDuration:1.0
                     animations:^{
                         //self.label1.alpha = 0.0;
                         self.label2.alpha = 1.0;
                         self.label1.center = CGPointMake(100.0, 43);
                     }
                     completion:^(BOOL finished){}];
相关文章
|
12月前
|
iOS开发
iOS 动画绘制圆形
iOS 动画绘制圆形
73 1
|
11月前
|
编译器 iOS开发 异构计算
读iOS核心动画笔记
读iOS核心动画笔记
44 0
|
9天前
|
Swift iOS开发 UED
揭秘一款iOS应用中令人惊叹的自定义动画效果,带你领略编程艺术的魅力所在!
【9月更文挑战第5天】本文通过具体案例介绍如何在iOS应用中使用Swift与UIKit实现自定义按钮动画,当用户点击按钮时,按钮将从圆形变为椭圆形并从蓝色渐变到绿色,释放后恢复原状。文中详细展示了代码实现过程及动画平滑过渡的技巧,帮助读者提升应用的视觉体验与特色。
31 11
|
1月前
|
Swift iOS开发 UED
【绝妙创意】颠覆你的视觉体验!揭秘一款iOS应用中令人惊叹的自定义动画效果,带你领略编程艺术的魅力所在!
【8月更文挑战第13天】本文通过一个具体案例,介绍如何使用Swift与UIKit在iOS应用中创建独特的按钮动画效果。当按钮被按下时,其形状从圆形变化为椭圆形,颜色则从蓝色渐变为绿色;释放后,动画反向恢复原状。利用UIView动画方法及弹簧动画效果,实现了平滑自然的过渡。通过调整参数,开发者可以进一步优化动画体验,增强应用的互动性和视觉吸引力。
35 7
|
iOS开发
iOS 常用阅读软件打开书籍的转场动画
iOS 常用阅读软件打开书籍的转场动画
80 0
|
4月前
|
iOS开发
iOS设备功能和框架: 如何使用 Core Animation 创建动画效果?
iOS设备功能和框架: 如何使用 Core Animation 创建动画效果?
123 0
|
12月前
|
API iOS开发
iOS 自定义转场动画 UIViewControllerTransitioning
iOS 自定义转场动画 UIViewControllerTransitioning
80 0
|
API iOS开发
iOS 核心动画
iOS 核心动画
78 0
|
iOS开发
iOS - 个人中心果冻弹性下拉动画
iOS - 个人中心果冻弹性下拉动画
242 0
iOS - 个人中心果冻弹性下拉动画
|
iOS开发
iOS开发-导航栏标题动画
iOS开发-导航栏标题动画
185 0
iOS开发-导航栏标题动画