0108 UIview 动画


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//打印动画块的位置
NSLog(@"动画执行之前的位置:%@",NSStringFromCGPoint(self.customView.center));

//首尾式动画
[UIView beginAnimations:nil context:nil];
//执行动画
//设置动画执行时间
[UIView setAnimationDuration:2.0];
//设置代理
[UIView setAnimationDelegate:self];
//设置动画执行完毕调用的事件
[UIView setAnimationDidStopSelector:@selector(didStopAnimation)];
self.customView.center=CGPointMake(200, 300);
[UIView commitAnimations];

}

 

 

-(void)didStopAnimation
{
NSLog(@"动画执行完毕");
//打印动画块的位置
NSLog(@"动画执行之后的位置:%@",NSStringFromCGPoint(self.customView.center));
}

posted @ 2016-01-08 09:22  zhen_zhen  阅读(139)  评论(0编辑  收藏  举报