没有按钮的UIAlertView以及如何关闭它

Spi*_*ire 3 iphone xcode uialertview

我在警报视图中有活动指示器,直到我的应用程序获得服务器响应时才会使用.应用程序将数据发送到服务器,警报视图显示,当服务器向我发送响应时如何关闭它.这是来自我的警报的代码

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Canceling reservation" message:@"please wait" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
        [alert show];

        UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

        // Adjust the indicator to place at the bottom of the dialog window.
        indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height-50);
        [indicator startAnimating];
        [alert addSubview:indicator];
Run Code Online (Sandbox Code Playgroud)

iAr*_*zki 7

[alert dismissWithClickedButtonIndex:0 animated:YES];
Run Code Online (Sandbox Code Playgroud)