UIView *view = [[UIView alloc] initWithFrame:CGRectMake(50, 100,
200, 30)];
[UIView
beginAnimations:@"View Flip" context:nil];
[UIView
setAnimationDuration:2.25];
[UIView
setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView
setAnimationDelegate:self];//一定要设置动画的委托
view.backgroundColor = [UIColor blackColor];
view.alpha =
0.0;
view.layer.cornerRadius = 3;
[self.view
addSubview:view];
//[view setFrame:CGRectMake(50, 150, 200, 30)];
通过修这个view的位置可以实现滑动效果
[view
release];
[UIView
commitAnimations];
然后实现动画的开始或结束的回调函数
-(void)animationDidStop:(CAAnimation *)anim
finished:(BOOL)flag{//当动画结束之后的回调函数,如可删除先前弹出的那个view框
避免view一直留在父view中
NSLog(@"%@",anim.description);//值为View Flip
if (flag)
{
NSLog(@"dfsdd");
}
}
-(void)animationDidStart:(CAAnimation *)anim{//动画开始之后
}
网络上志同道合,我们一起学习网络安全,一起进步,QQ群:694839022