「何かをする->アラート1を表示する->何かをする->アラート2を表示する」というコードを書きます。
//do something
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Alert 1"
message:nil
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
//do something
UIAlertView *alert2 = [[UIAlertView alloc]
initWithTitle:@"Alert 2"
message:nil
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert2 show];
[alert2 release];
そして突然、複数の AlertView に奇妙なことが起こりました: "Alert 1" -> "Alert 2" ('OK' を押す) -> "Alert 1" と表示されます。「アラート 1」が再度表示されるのはなぜですか? デリゲート メソッドはまだ作成していません。もしかしてバグ?
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex がうまく機能することがわかりました。デリゲート メソッドは、複数の alertViews を表示する一般的な方法ですか?