iOS面试——动画

来源:互联网 发布:java io流测试题 编辑:程序博客网 时间:2024/05/17 01:24

一、View的哪些属性可以做动画?

动画分类:

 1.骨骼动画,图片帧(如人、动物走动)(UIImageView)

 2.属性动画(如物品放入购物车进行移动)(UIView)

 3.转场动画(一个到另一个场景,如翻页)(UIView)

 4.层动画(CAAnimationLayer)

可以做动画的值

1.形状系列:frame bounds

 2.位置系列:center

 3.色彩系列:alpha color

 4.角度系列:transform(旋转的角度)

 会冲突的属性:

 1.frame center

 2.frame transform

 3.frame bounds

 4.bounds transform

二、 定义UIView动画开始函数是什么?结束函数是什么?

将要开始时调用

- (void)animationWillStart:(NSString *)animationID context:(void *)context{

    NSLog(@"start:%@,%@",animationID,context);

}

结束时调用

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context{

    NSLog(@"stop:%@,%@",animationID,context);

}

1.准备:

[UIViewbeginAnimations:@"view"context:nil];

2.持续时间:

[UIViewsetAnimationDuration:2];

3.回调函数:

[UIViewsetAnimationDelegate:self];

4.动画曲线、速度:

[UIView  setAnimationCurve:UIViewAnimationCurveEaseInOut];

(1)开始和结束慢:UIViewAnimationCurveEaseInOut

(2)开始慢:UIViewAnimationCurveEaseIn

(3)结束慢:UIViewAnimationCurveEaseOut

(4)动画曲线:UIViewAnimationCurveLinear

5.动画方式,起始位置:

[UIView  setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view  cache:YES];

(1)无:UIViewAnimationTransitionNone

(2)左:UIViewAnimationTransitionFlipFromLeft

(3)右:UIViewAnimationTransitionFlipFromRight

(4)上:UIViewAnimationTransitionCurlUp

(5)下:UIViewAnimationTransitionCurlDown

6.提交:

[UIViewcommitAnimations];





0 0
原创粉丝点击