UIAlertView带来了完全意想不到的功能

时间:2011-04-29 16:52:13

标签: iphone

    -(void) buttonClick:(id) sender
{

    action=[[UIAlertView alloc] initWithTitle:nil message:@"Confirm for action" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];

    [action addButtonWithTitle:@"Yes"];


    [action show];
    [action release];



}

    - (void)alertView:(UIAlertView *)action didDismissWithButtonIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 1) {
        [self func1];
    }
    else if (buttonIndex ==0)  //cancel
    {

    }
}

而不是在点击时执行func1在alertview上是,应用程序会在我的应用程序注册页面中弹出一个注册表单。

1 个答案:

答案 0 :(得分:0)

在“if(buttonIndex == 1)”上设置断点并使用“步入”按钮执行代码。问题应该在你的程序中的其他地方。