私はこの2ボタンのアラートビューを持っています:
UIAlertView* message = [[UIAlertView alloc]
initWithTitle: @"Delete?" message: @"This business will be deleted permenently." delegate: nil
cancelButtonTitle: @"Cancel" otherButtonTitles: @"Delete", nil];
[message show];
私もこの方法を持っています:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Delete"])
{
NSLog(@"Button DELETE was selected.");
}
else if([title isEqualToString:@"Cancel"])
{
NSLog(@"Button CANCEL was selected.");
}
}
これを.hファイルに追加しました。
<UIAlertViewDelegate>
現在、いずれかのボタンを押すと、ダイアログが閉じます。キャンセルしても大丈夫ですが、削除ボタンが押されたことをどうやって知ることができますか?
ありがとう!