Objective c 缺失';[';at消息发送表达式
我收到了这个错误消息,并且匹配了我的括号,但是没有发现任何错误。你能找到什么错误吗 多谢各位 错误消息在相关行上注释掉;文件名为MyHorizLine.m:Objective c 缺失';[';at消息发送表达式,objective-c,xcode4,Objective C,Xcode4,我收到了这个错误消息,并且匹配了我的括号,但是没有发现任何错误。你能找到什么错误吗 多谢各位 错误消息在相关行上注释掉;文件名为MyHorizLine.m: #import "MyHorizLine.h" @implementation MyHorizLine -(id)initWithCoder:(NSCoder *)decoder { self [super initWithCoder:decoder]; //Missing '[' at message send expressio
#import "MyHorizLine.h"
@implementation MyHorizLine
-(id)initWithCoder:(NSCoder *)decoder
{
self [super initWithCoder:decoder]; //Missing '[' at message send expression
if (self) {
self.backgroundColor = [UIColor clearColor];
}
return self;
}
-(void)drawRect:(CGRect)rect
{
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextMoveToPoint(c, 0, 0);
CGContextAddLineToPoint(c, self.bounds.size.width, 0);
CGContextStrokePath(c);
}
@end
这行应该是
self = [super initWithCoder:decoder];
您缺少一个
=
:
self [super initWithCoder:decoder];
应该是
self = [super initWithCoder:decoder];
谢谢你,我一直在检查牙套,没看到“=”符号。