在备份过程结束时,我想让用户知道备份已完成。我曾经使用UIAlertView,它工作。然而,它的贬值,所以换了UIAlertController这些。弹出消息完成后,窗口关闭。新的UIAlertController在这种情况下似乎不起作用。我究竟做错了什么?UIAlertController doesnt popup
这种情况正在发生,视图关闭之前的过程结束。下面代码中的最后一行是关闭视图。 UIAlertView必须是模态或阻止视图关闭的东西?
我曾经使用这个代码,它工作得很好。
UIAlertView *myalert = [[UIAlertView alloc] initWithTitle:nil message:Msg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[myalert show];
[self presentViewController:alert animated:YES completion:nil];
,你不要这个新的代码中看到的任何东西
UIAlertController * alert= [UIAlertController
alertControllerWithTitle:@""
message:Msg
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* okButton = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:okButton];
[self presentViewController:alert animated:YES completion:nil];
[self dismissViewControllerAnimated:NO completion:nil];
警报的看法? [self dismissViewControllerAnimated:NO completion:nil]; –
标记答案问题已解决 –
这种情况正在发生,视图关闭之前的过程结束。下面代码中的最后一行是关闭视图。 UIAlertView必须是模态或阻止视图关闭的东西? –