alertview的自动消失

- (IBAction)alert:(id)sender {

alertView = [[UIAlertView alloc] initWithTitle:@"Hello"

message:@"I will dismiss later..."

delegate:nil

cancelButtonTitle:@"Dismiss now" otherButtonTitles:nil, nil];

[NSTimer scheduledTimerWithTimeInterval:3.0f  target:self  selector:@selector(dismissAlertView:)  userInfo:nil  repeats:NO];

[alertView show];

}

- (void)dismissAlertView:(NSTimer*)timer {

NSLog(@"Dismiss alert view");

[alertView dismissWithClickedButtonIndex:0 animated:YES];

}

你可能感兴趣的:(alertview的自动消失)