2012-07-14 3 views
0

난 당신이 모두 같은이 볼 수 있듯이 몇 가지 오류 enter image description hereUIAlertView 코드 오류

을 가지고 있지만 난 단지 그들을 있었다 이하 나는 아이폰 OS 장치 만 imagee에 응용 프로그램을 만드는거야 오류가 내가 추가 감지 잘못 됐을 뭐죠 링크 (사과, 구글, 야후에 대한 코드,

메신저 확실하지 않지만 도움이 내가 그들에게 오류를 중지 변경할 필요가 무엇인지 말해 줄 수 있다면 정말 감사하겠습니다.


당신이 볼 수 있듯이 여기에만 경고 코드 아래의 쇼에 있지만 난 그냥 모든 공간을 차지하지 않았다 엑스 코드의 다른 (10)이 있습니까하지만 난

showAlertOO showAlert1 showAlert2 showAlert3 showAlert4처럼라는 이름의 한 showAlert5 showAlert6 showAlert7 showAlert8 showAlert9

당신은 내가 무슨 뜻인지 얻을 경우

- (void) showAlert { 

     UIAlertView *alert = [[UIAlertView alloc] 

           initWithTitle:@"hello" 
           message:@"whats you name" 
           delegate:nil 
           cancelButtonTitle:@"Dismiss" 
           otherButtonTitles:@"apple", @"google" , @"yahoo", nil]; 



     [alert show]; 

오케이 이것이 작동하도록 버튼을 추가하기 위해 추가 한 코드입니다. 그러면 이것이 오류를 생성 한 것입니다.

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

if (buttonIndex == 1) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com/uk"]]; 
     } 
    if (buttonIndex == 2) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]]; 
    } 
     if (buttonIndex == 3) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.yahoo.com"]]; 
     } 

모든 코드는 아래 괜찮습니다 그리고 난 여기에 오류가없는 난 그냥 너희들은 내가

-(IBAction)plus { 
     counter=counter + 1; 
     count.text = [NSString stringWithFormat:@"%i",counter]; 
     if(counter == 100) 
      [self showAlert]; 
     if(counter == 500) 
      [self showAlert00]; 
     if(counter == 1000) 
      [self showAlert1]; 
     if(counter == 2500) 
      [self showAlert2]; 
     if(counter == 5000) 
      [self showAlert3]; 
     if(counter == 7500) 
      [self showAlert4]; 
     if(counter == 10000) 
      [self showAlert5]; 
     if(counter == 15000) 
      [self showAlert6]; 
     if(counter == 20000) 
      [self showAlert7]; 
     if(counter == 25000) 
      [self showAlert8]; 
     if(counter == 30000) 
      [self showAlert9]; 
     if(counter == 35000) 
      [self showAlert10]; 
    } 



    -(IBAction)zero { 
     counter=0; 
     count.text = [NSString stringWithFormat:@"%i",counter]; 
    } 




    - (void)viewDidLoad { 
     counter=0; 
     count.text = @"0"; 
      [super viewDidLoad]; 

    } 

이 시간 내 주셔서 대단히 감사합니다 가지고있는 설정보고 싶었다.

답변

1

실제로 사용하기 전에 선택기의 showAlert '...'showAlert10 '을 선언 했습니까? 그렇지 않은 경우에는 .m 파일의 맨 위에있는 개인 범주로 선언 할 수 있습니다.

한편 ... 'showAlert5'대신 설명적인 이름을 사용하는 것이 좋습니다. 결국에는 앞으로와 앞으로 갈 시간을 절약 할 수 있습니다. 단지 코드가 아닌 어디서나 사용할 수 있습니다.

+0

당신의 충고에 감사드립니다 어떻게 그 다음에 내가 가장 좋은 코더가 아니라고 미안하다고 선언합니까 lol – Picm

+0

그것은 단지 제안 일 뿐이에요. 그래도 문제가 있으면 알려주세요. –

+0

괜찮아요. 그래도 여전히 같은 오류가 있어요. 문제가있는 것 같아요! – Picm