UIAlertController * alert = [UIAlertController alertControllerWithTitle:string message:nil preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alert animated:NO completion:nil];
[NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(creatAlert:) userInfo:alert repeats:NO];
- (void)creatAlert:(NSTimer *)timer{
UIAlertController *alert = [timer userInfo];
[alert dismissViewControllerAnimated:YES completion:nil];
alert = nil;
}
网友评论