0

我可以在计时器关闭后显示另一个 UIAlertview 吗?我使用这种方法 UIActivityindicatorview 到 UIAlertView 与 NSTimer 自行解除它“请等待,正在保存...”被解除,然后我想查看另一个 UIAlertView 说“已成功保存!” (完毕)。如何做到这一点?谢谢你。

在这里我使用相同的这种方法,但这不是我需要的。我只需要在计时器关闭第一个 uialertview 后查看另一个 UIAlertview。

如果需要更清楚,请告诉我,我可以在这里发布我的代码,谢谢。

- (IBAction)showAlert:(id)sender {

    UIAlertView* alert_view = [[UIAlertView alloc]
                               initWithTitle: @"Save" message:@"please wait, saving..." delegate: self 
                               cancelButtonTitle:@"done" otherButtonTitles:nil];
    [alert_view show];
    [alert_view release];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{ 
    if (buttonIndex==0) {

        UIAlertView* alert_view = [[UIAlertView alloc]
                               initWithTitle: @"Success" message:@"Saved Successfully!" delegate: self 
                               cancelButtonTitle: @"Done" otherButtonTitles:nil];

         [alertView dismissWithClickedButtonIndex:0 animated:TRUE];
    }
    else{
        [alertView dismissWithClickedButtonIndex:1 animated:TRUE];
    }
}
4

1 回答 1

0

计时器不是解决此问题的方法。您是在伪造它,而不是正确地实施它。如果涉及多个类,则需要使用协议和委托,但最终,您需要遵循以下流程:

1) 显示“请稍候...正在保存”警报

2)做储蓄

3) 保存完成后,关闭第一个警报,然后显示第二个。

根据您如何保存 WHAT,这可能需要一些额外的逻辑来实现,但如果没有更多细节,很难提供更多帮助。

于 2013-03-01T20:53:44.920 回答