UIAlertView 自动dismiss? (先设NSTimer,后调用Delegate)

- (void) performDismiss: (NSTimer *)timer

{
    [baseAlert dismissWithClickedButtonIndex:0 animated:NO];//important
    [baseAlert release];
    baseAlert = NULL;
}
 
- (void) presentSheet
{
    baseAlert = [[UIAlertView alloc]
                              initWithTitle:@"Alert" message:@"\nMessage to user with asynchronous information"
                              delegate:self cancelButtonTitle:nil
                              otherButtonTitles: nil];
    [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector: @selector(performDismiss:)
                                   userInfo:nil repeats:NO];
    [baseAlert show];
}
posted on 2012-06-03 23:10  easonoutlook  阅读(209)  评论(0编辑  收藏  举报