- (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]; }]; }
时间: 2024-10-25 15:40:21