文件名称:使用关键帧实现反弹球的动画-intel单cpu芯片组上电时序
文件大小:20.35MB
文件格式:PDF
更新时间:2024-07-30 20:56:02
iOS动画, core animation, 核心动画
清单10.6 使用关键帧实现反弹球的动画 @interface ViewController () @property (nonatomic, weak) IBOutlet UIView *containerView; @property (nonatomic, strong) UIImageView *ballView; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; //add ball image view UIImage *ballImage = [UIImage imageNamed:@"Ball.png"]; self.ballView = [[UIImageView alloc] initWithImage:ballImage]; [self.containerView addSubview:self.ballView]; //animate [self animate]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //replay animation on tap [self animate]; } - (void)animate { //reset ball to top of screen ios核心动画高级技巧 243自定义缓冲函数