2010-12-31 6 views
1

약간의 문제가 있습니다. 내가 작성한 iOS 프로그램에 몇 가지 변경 사항을 적용하고 있지만 문제가 발생했습니다. 나는 지속적으로 "예상 '{'before ')'토큰 '경고를 얻지 만 코딩 기술은 문제를 발견하기에 충분하지 않습니다. 약간의 도움이 크게 감사 할 것입니다.상수 예상 "{"before ")"토큰

#import "Search.h" 
#import "RootViewController.h" 

    //button 
    - (IBAction)buttonPressed)sender{ 
    RootViewController *newview = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; 
    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:0.5]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionFl ipFromRight forView:self.view cache:YES]; 
    [self.view addSubview:newview.view]; 
    [UIView commitAnimations]; 

    @implementation Search 
@end 
+0

또한 buttonPressed 메서드 *를 @implementation 블록 내부에 넣어야합니다. –

답변

0
- (IBAction)buttonPressed)sender{ 

- (IBAction)buttonPressed:(id)sender{ 

수 그리고 당신은}

[UIView commitAnimations]; 

처럼 후 필요할까요 :

[UIView commitAnimations]; 

} 
0

코드 블록 - (IBAction)buttonPressed)sender{을 완료하지 않았습니다. buttonPressed 메서드가 끝나는 코드를 알기 위해 끝 부분 (})이 필요합니다.

1

올바른 구문이 될 것

#import "Search.h" 
#import "RootViewController.h" 


    @implementation Search 
//button 
- (IBAction)buttonPressed:(id)sender { 
     RootViewController *newview = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; 
     [UIView beginAnimations:nil context:NULL]; 
     [UIView setAnimationDuration:0.5]; 
     [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES]; 
     [self.view addSubview:newview.view]; 
     [UIView commitAnimations]; 
    } 

@end 
+0

방법 이름 뒤에 :을 (를) 잊어 버렸습니다. buttonPressed : (id) 보낸 사람 – Josh

+0

와우 조쉬, 그게 내 downvote 이유는 무엇입니까? 조금 가혹한 :) –

관련 문제