在实现上下文中缺少@end [英] @end missing in implementation context

查看:91
本文介绍了在实现上下文中缺少@end的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有足够的声誉来发布图片..因此希望您能够为我提供帮助.在第三行显示"@implementation viewcontroller"的地方,我的xcode告诉我此"@end在实现上下文中丢失" 预先感谢!

I do not have enough reputation to post an image.. so hopefully you will be able to help me through this. on the third line where is says "@implementation viewcontroller" my xcode is telling me this "@end is missing in implementation context" thanks in advance!

@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);
}

推荐答案

@implementation ViewController的末尾,您需要@end

您的.m应该如下所示:

Your .m should look like this:

@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

这篇关于在实现上下文中缺少@end的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆