-3

我没有足够的声誉来发布图片.. 所以希望你能帮助我解决这个问题。在第三行说“@implementation viewcontroller”我的xcode告诉我这个“@end在实现上下文中丢失”提前谢谢!

@interface ViewController ()
@end

@implementation ViewController

- (void)viewDidLoad {
    mainInt = 0;
    randomMain = [NSTimer scheduledTimerWithTimeInterval:(1.0/1.0) target:self selector:@selector(randomMainvoid) userInfo:nil repeats:YES];
}


- (void)randomMainvoid {
    mainInt +=1;
    label.text = [NSString stringWithFormat:@"%d", mainInt];       
}    


- (IBAction)Start {
    [startButton setHidden:YES];
    timer = [NSTimer scheduledTimerWithTimeInterval:(0.0088) target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
    pos = CGPointMake(5.0, 6.0);
}
4

2 回答 2

2

最后@implementation ViewController你需要@end

您的 .m 应如下所示:

@interface ViewController ()
@end

@implementation ViewController

- (void)viewDidLoad {
    mainInt = 0;
    randomMain = [NSTimer scheduledTimerWithTimeInterval:(1.0/1.0) target:self selector:@selector(randomMainvoid) userInfo:nil repeats:YES];
}


- (void)randomMainvoid {
    mainInt +=1;
    label.text = [NSString stringWithFormat:@"%d", mainInt];       
}    


- (IBAction)Start {
    [startButton setHidden:YES];
    timer = [NSTimer scheduledTimerWithTimeInterval:(0.0088) target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
    pos = CGPointMake(5.0, 6.0);
}

@end
于 2013-04-02T05:18:13.130 回答
0

- (IBAction)Start {
    [startButton setHidden:YES];
    timer = [NSTimer scheduledTimerWithTimeInterval:(0.0088) target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
    pos = CGPointMake(5.0, 6.0);
}

添加@end

于 2013-04-02T05:19:26.020 回答