2012-10-29 4 views
1

단추가있는 UIAlertView가 있는데이 단추가 동작을 수행하도록하려고합니다. 문제는 내 메서드에서 "선언되지 않은 식별자"입니다.선언되지 않은 식별자 (동작이있는 경고보기) 사용

내가 http://tinypic.com/view.php?pic=28qvhom&s=6

하는 코드

경고보기

UIAlertView *alert = [[UIAlertView alloc] 
    initWithTitle:@"Well done!" 
    message: @"You got all 20 in Time: x" 
    delegate:nil 
    cancelButtonTitle:nil 
    otherButtonTitles:@"Save and Quit", @"Quit", nil]; 


[alert show];} 

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

{ 

    if(buttonIndex==0) {/*some action */ } 
    else if(butonIndex==1){/*some action */} 

} 


    //I aso have <UIAlertViewDelegate> in my .h file. 

답변

0

문제는 else if(butonIndex==1) 당신이 "두 번째를 놓치고 공백을 참조 ISSUE 단어 버튼에 "t"를 입력하십시오.

나중에 참조 할 수 있도록 Xcode의 "픽스 잇 (Fix-It)"기능은 이와 같은 사소한 실수를 수정합니다.

enter image description here

는 단순히 Enter 키를 누르 수정 - 그것 메뉴를 활성화하기 위해 빨간색 동그라미를 클릭합니다.

편집 :

이를 수행

- (void)myMethod{ 

} 

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

} 

를하지 않음이 :

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

    } 
} 

이 경우가 아니라면, 당신은 닫는 중괄호 누락 "}" 경고보기 대리인 앞의 메서드 끝.

+0

시간 내 주셔서 감사합니다.하지만 여전히 문제를 분류하지는 않았습니다. 이것이 내가 본 것입니다 http://tinypic.com/view.php?pic=wa2ijq&s=6 –

+0

@ JeevanThandi 그러면 정확히 무엇이 문제입니까? 위에서 언급 한 것은 "buttonIndex"의 철자를 수정 한 고정 값이없는 선언되지 않은 식별자 오류입니다. –

+0

http://tinypic.com/view.php?pic=28qvhom&s=6 –

관련 문제