首页 > 其他 > 详细

定时消失的Alert弹窗

时间:2017-09-06 17:07:38      阅读:265      评论:0      收藏:0      [点我收藏+]

在公共类里面写如下两个类方法就可以了,只需要把第一个类方法公布出来:

代码如下:

#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];
    }
}

  

定时消失的Alert弹窗

原文:http://www.cnblogs.com/Walking-Jin/p/7485726.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!