开发者

UIAlertView shows up several times after Home Button is pressed

Iam calling this Code in my ViewController if some Settings are not set or are (by the length) zero:

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

The Alertview shows up and if I press the Home Button and start the App again it shows the Alert zwice, after that if i press the Home Button again an开发者_如何学运维d start the App the Alert shows up 4 times.....

Why the hell is it like this?

I tried to define a new function for it and tried many other workarounds but nothing worked out for me.

Somebody any Suggestions?


Something like this

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜