定时消失的Alert弹窗
在公共类里面写如下两个类方法就可以了,只需要把第一个类方法公布出来:
代码如下:
#pragma mark --- 定时弹窗 ---
+ (void)showAlertViewWithTitle:(NSString *)title message:(NSString *)message afterDelay:(NSTimeInterval)delay {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
[alert show];
[self performSelector:@selector(dimissAlert:) withObject:alert afterDelay:delay];
}
+ (void)dimissAlert:(UIAlertView *)alert {
if(alert) {
[alert dismissWithClickedButtonIndex:[alert cancelButtonIndex] animated:YES];
}
}
posted on 2017-09-06 16:55 Walking_Jin 阅读(1162) 评论(0) 收藏 举报
浙公网安备 33010602011771号