我有一点问题。我正在对我编写的iOS程序进行一些更改,但我遇到了一个问题。我不断得到一个“预期'{'之前'''令牌”警告,但我的编码技能不足以找到问题。一点帮助将非常感激。
#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 :(得分: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
答案 1 :(得分:0)
您尚未完成代码块- (IBAction)buttonPressed)sender{
。您需要在某处使用结束括号(}
)来告诉代码buttonPressed
方法结束的位置。
答案 2 :(得分:0)
- (IBAction)buttonPressed)sender{
应该是
- (IBAction)buttonPressed:(id)sender{
你需要一个}之后
[UIView commitAnimations];
像:
[UIView commitAnimations];
}