- (void)showAutoDialogWithTitle:(NSString *)title message:(NSString *)message
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:nil];
[alert show];
[NSTimer scheduledTimerWithTimeInterval:1.0f
target:self
selector:@selector(dismissAlert:)
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:alert, @"autoalert" ,nil] //如果不用传递参数,那么可以将此项设置为nil.
repeats:NO];
NSLog(@"release alert");
[alert release];
}
-(void) dismissAlert:(NSTimer *)timer{
NSLog(@"release timer");
UIAlertView *alert = [[timer userInfo] objectForKey:@"autoalert"];
[alert dismissWithClickedButtonIndex:0 animated:YES];
[_timer invalidate];
_timer = nil;
}
3537

被折叠的 条评论
为什么被折叠?



