gpt4 book ai didi

ios - 使用sharedmanager后的警报

转载 作者:行者123 更新时间:2023-11-29 03:48:32 26 4
gpt4 key购买 nike

这是我的代码

audioViewController *voiceRecorder = [audioViewController sharedManager];
[voiceRecorder stopRecording];
NSString *msg = [NSString stringWithFormat:@"Want to logout?"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Info"
message:msg
delegate:self
cancelButtonTitle:@"No"
otherButtonTitles:@"Yes", nil];
alert.tag = 100;
[alert show];

我正在我的一个 View Controller 中调用sharedManager。问题是,我的alertview在sharedManager方法执行之前运行,如果你检查我的代码,我已经调用了“StopReording”方法,但是当我运行代码时,它在显示警报后起作用。任何人都知道,如何仅在方法返回某些内容后才显示警报。?

最佳答案

您似乎对方法运行顺序和警报呈现顺序感到困惑。这些方法必须按照代码指定的顺序运行。您在屏幕上看到的是 2 个警报,一个(停止)首先出现,另一个(注销)紧随其后出现。

通常,您不应同时显示 2 个警报。如果它们涉及不同的事物,当然不是。

呈现您的第一个警报,然后等待收到答案(使用委托(delegate)方法)。一旦您得到用户的回答,然后决定下一步做什么并显示第二个警报或继续执行其他操作。

关于ios - 使用sharedmanager后的警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17387065/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com