创建一个自动消失的 UIAlertView

2011-04-28

创建一个 自动消失的 UIAlertView

-(void) performDismiss:(NSTimer *)timer
{
    [Alert dismissWithClickedButtonIndex:0 animated:NO];
    [Alert release];
}

-(void)presentSheet
{
    Alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"出错啦!" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];
    
    [NSTimer scheduledTimerWithTimeInterval:2.0f target:self selector:@selector(performDismiss:) userInfo:nil repeats:NO];
    [Alert show];
}