2014-09-10 3 views
-2
@interface ViewController() 

@property (weak, nonatomic) IBOutlet UILabel *rollButtonClicked; 

-(IBaction)rollButtonClicked:(id)sender 

{ 
    int roll = [self.model getDiceRoll]; 
    int roll2 = [self.model getDiceRoll]; 

    [self.firstDieView showDie:roll]; 
    [self.secondDieView showDieroll2]; 

    NSString *sumText = [NSString stringWithFromat:@"Sum is %d", roll + roll2]; 

    self.sumLabel.text = sumText; 

} 

나는 오류가 계속 - (IBAction를가) rollButtonClicked (ID) 보낸 난 '('얻을 것이다 그리고 난 그것을 엑스 코드를 제거하는 경우 당신은 내가 객체 C에서 여전히 새로운 해요 볼 수목표 - C 간단한 에러 코드를 '('난 후에 세미 콜론을 배치하면

당신을 감사 도와주세요 (ID) 보낸 사람

: (IBAction를) rollButtonClicked - 그것은 내가 이 후 세미콜론이 필요 말한다 때문에 나에게 문제를 보여줍니다

답변

0

헤더 파일 ()에서 작업하고 있습니다.). 이
만과 같이 함수를 선언해야합니다

- (IBaction)rollButtonClicked:(id)sender; 

을 구현 파일에서 (.m)를 추가 코드 :

- (IBaction)rollButtonClicked:(id)sender { 
    int roll = [self.model getDiceRoll]; 
    int roll2 = [self.model getDiceRoll]; 

    [self.firstDieView showDie:roll]; 
    [self.secondDieView showDieroll2]; 

    NSString *sumText = [NSString stringWithFromat:@"Sum is %d", roll + roll2]; 

    self.sumLabel.text = sumText; 
}