自定义Lable提示框(渐变动画)

时间:2015-07-14 05:56:13   收藏:0   阅读:257
- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 移除按钮不能使用,开始默认
    self.removeBtn.enabled = NO;
    self.alertView.textAlignment = UITextAlignmentCenter;
    self.alertView.alpha = 0.0; // 完全透明
    self.alertView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:0 alpha:0.5];
}


/** 显示指示器 方法封装 */
- (void)showHud:(NSString *)text
{
    self.alertView.text = text;
    
    // 慢慢出现(出现动画持续1秒)
    [UIView animateWithDuration:1.0 animations:^{
        self.alertView.alpha = 1.0;
    } completion:^(BOOL finished) {
        
        // 1.5秒后,再慢慢消失(消失动画持续1秒)
        [UIView animateWithDuration:1.0 delay:1.5 options:kNilOptions animations:^{
            self.alertView.alpha = 0.0;
        } completion:nil];
        
    }];
}

 

原文:http://www.cnblogs.com/cjpBlog/p/4644321.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!