制作渐渐消失的弹框提示

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{//动画开始之后
}
原文地址:https://www.cnblogs.com/cnsec/p/11515884.html