-1

运行代码时出现错误:这行代码显示未声明的“alertView”标识符:

-(void)alertView:(UIAlertView* )alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {

        if(buttonIndex==0) 
        else if(butonIndex==1)

    }

谢谢您的帮助。

4

2 回答 2

0

它类似于以下内容。

- (void)dismissPop2:(NSString *)projectname {
    projectdelete = projectname;
    NSString *msg = [NSString stringWithFormat:@"Are you sure you want to delete this project (%@)?",projectname];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"- Project deletion -"
                                                message:msg
                                               delegate:self
                                      cancelButtonTitle:@"Cancel"
                                      otherButtonTitles:@"Delete", nil];
    [alert setTag:100];
    [alert show];
}

- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView { // Validation
    if ([alertView tag] == 100) {
        return YES;
    }

    else {
        return YES;
    }
}

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
    if ([alertView tag] == 100) {
    // Deleting a project
    if (buttonIndex == 1) {
        // Do something since the user has tapped YES
    }
}

如果它没有帮助,那么你应该展示更多的工作。

于 2013-05-15T04:02:39.790 回答
0

您的代码中可能有一个语法错误会破坏解析器。检查以确保您发布的函数上面的函数以 } 结束,所有 [] 都匹配,并且语句以 ; 结尾

如果您发布更多内容,可能有人会指出,但我相信您可以通过阅读您的代码找到它。

于 2013-05-15T04:05:51.483 回答