繁体   English   中英

按下主页按钮后,UIAlertView显示几次

[英]UIAlertView shows up several times after Home Button is pressed

如果某些设置未设置或(按长度计)为零,我将在ViewController中调用此代码:

UIAlertView *infoView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Achtung", nil) message:NSLocalizedString(@"Wrong Settings",nil)delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [infoView show];
    [infoView release]; 

Alertview出现,如果我按下Home按钮并再次启动应用程序,它将显示Alert zwice,此后,如果我再次按下Home Button并启动App,则警报显示4次。

为什么会这样呢?

我尝试为其定义一个新函数,并尝试了许多其他解决方法,但没有任何解决方案。

有人建议吗?

像这样

- (void)viewWillDisappear {
    [super viewWillDisappear];
    [myAlert dismissWithClickedButtonIndex:0 animated:NO];
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM