Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 嵌套视图逻辑_Iphone_Ios_Objective C_Uialertview_Nested - Fatal编程技术网

Iphone 嵌套视图逻辑

Iphone 嵌套视图逻辑,iphone,ios,objective-c,uialertview,nested,Iphone,Ios,Objective C,Uialertview,Nested,在我的应用程序中,我有一个按钮,允许用户购买当前项目 我希望用户确认,他接受了销售协议,然后他选择了他喜欢的付款方式 我的逻辑如下 用户点击“购买”按钮后,弹出以下UIAlertView: NSMutableString *msg = [[NSMutableString alloc] initWithFormat:@"By recognizing this agreement you agree, that in following 15 minutes you will pay for %@

在我的应用程序中,我有一个按钮,允许用户购买当前项目

我希望用户确认,他接受了销售协议,然后他选择了他喜欢的付款方式

我的逻辑如下

用户点击“购买”按钮后,弹出以下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];
在my-(void)alertView:(UIAlertView*)alertView中单击按钮索引:(NSInteger)按钮索引
我正在检查他是否接受

        - (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");
        }
    }
我的问题是,在向用户显示第二个警报(typeBuyout)和用户做出选择后,ClickedButtonIndex不会启动


我试图在viewDidLoad和ClickedButtonIndex中定义我的typeBuyout警报,只是[typeBuyout show];但结果相同。

将第二个alertview的委托设置为调用
ClickedButtonIndex
方法

if(buttonIndex == 1)
 {
            UIAlertView *typeBuyout = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Anonymous payment", nil)
                                                   message:NSLocalizedString(@"Do you wish to make payment as anon?", nil)
                                                  delegate:self
                                         cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
                                         otherButtonTitles:@"Anon buyout",@"Regular buyout",nil];
            typeBuyout.tag = 2;

            [typeBuyout show];

        } 

在第二个警报中,您没有给代理self,而是将其设置为零。检查它

在第二个警报中,你没有给DELGETE SELF,你给了NIL检查它(我可能需要更多的时间来查看这个),但是代表:NIL故意吗?08442,thx!!!你是对的,请把它写下来作为我可以接受的答案:)楠,不,他是对的,我只是复制粘贴的上一个警告,因为我是个懒惰的白痴(一个不必使用委托方法的白痴)为什么你只使用大写字母?谢谢你,纳齐克,我会投票,但接受08442的答案,因为他是第一个指出我懒惰的错误的人。。但是多谢你花时间!