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

代码如下:

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

  

相关文章:

  • 2022-01-20
  • 2021-05-29
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2021-12-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-04
  • 2021-11-02
  • 2022-01-01
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
相关资源
相似解决方案