私のアプリには、ユーザーが現在のアイテムを購入できるボタンがあります。
ユーザーに販売契約に同意したことを確認してもらい、希望する支払い方法を選択してもらいます。
この背後にある私の論理は次のとおりです。
ユーザーが購入ボタンをクリックすると、次のUIAlertViewがポップアップ表示されます。
NSMutableString *msg = [[NSMutableString alloc] initWithFormat:@"By recognizing this agreement you agree, that in following 15 minutes you will pay for %@ which has price of %@, if you won't make the payment, your account may be blocked for this item.",mainTitle.text,buyoutPrice.text];
UIAlertView *buyoutAlert = [[UIAlertView alloc] initWithTitle:@"Buyout" message:msg
delegate:self cancelButtonTitle:@"I don't agree" otherButtonTitles:@"I agree",nil];
buyoutAlert.tag = 1;
[buyoutAlert show];
私の-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
彼が受け入れるかどうかをチェックしています...
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(alertView.tag == 1)
{
if(buttonIndex == 1)
{
UIAlertView *typeBuyout = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Anonymous payment", nil)
message:NSLocalizedString(@"Do you wish to make payment as anon?", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:@"Anon buyout",@"Regular buyout",nil];
typeBuyout.tag = 2;
[typeBuyout show];
}
}
if(alertView.tag == 2)
{
if(buttonIndex == 1)
{
//anon
NSLog(@"anon");
}else if(buttonIndex == 2)
{
//normal
NSLog(@"Normal");
}
}
私の問題は、ユーザーに2番目のアラート(typeBuyout)を表示した後、ユーザーが選択を行った後、clickedButtonAtIndexが起動しないことです。
viewDidLoadとclickedButtonAtIndexでtypeBuyoutアラートを定義しようとしました[typebuyoutshow]; しかし、同じ結果になります。