2

私はこのコードを持っています:

//アラートを表示

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Actualizado" 
message:@"Se ha actualizado todo" delegate:self 
cancelButtonTitle:@"Aceptar" otherButtonTitles:nil, nil];
[alert show];

この

- (void)alertView:(UIAlertView *)alert 
clickedButtonAtIndex:(NSInteger)buttonIndex {
    NSLog(@"ALgo"); }

次のエラーが発生しました:

 -[__NSCFType alertView:clickedButtonAtIndex:]:
unrecognized selector sent to instance 0xdc559a0

助けてください。ありがとう

4

4 に答える 4

4

alertView:clickedButtonAtIndex:セレクター(デリゲート)を処理するオブジェクトまたはビューを解放しているようです。UIAlertViewあなたが扱われるまであなたがそれを保つことを確認してください。

于 2012-05-10T18:29:45.470 に答える
0

UIAlertViewDelegateをヘッダーファイルに追加しましたか?例:@interface yourclass:UIViewControllerこれが理由であるかどうかを確認します

于 2012-05-10T18:46:47.397 に答える
0
UIAlertView *alert = [[UIAlertView alloc]  initWithTitle:@"Actualizado" message:@"Se ha actualizado todo" delegate:self cancelButtonTitle:@"Aceptar" otherButtonTitles:nil, nil];

これを試して

于 2012-05-10T18:17:45.960 に答える
0

alertViewがViewControllerからインスタンス化されたオブジェクト内に作成されている場合は、そのオブジェクトへのポインターをViewControllerに保持する必要があります。

于 2014-03-20T18:29:31.717 に答える