AlertView应该自己消失

时间:2011-10-24 06:26:44

标签: iphone ios xcode

如何在不使用任何取消按钮的情况下使alertview自行消失。?

1 个答案:

答案 0 :(得分:7)

使用此...

-(void)showAlertView
{
   // code for showing your alertView
   [self performSelector:@selector(dismissAlertView) withObject:yourObject afterDelay:5]
}

-(void)dismissAlertView
{
    [yourAlert dismissWithClickedButtonIndex:0 animated:YES];
}