我正在开发一个 iPhone 4 应用程序,但我在类里面遇到了问题:
@interface Pattern : NSObject {
int maxNumShapes;
NSMutableArray* shapes;
NSMutableArray* shapeMatched;
CGSize bounds;
}
@property (nonatomic, retain, readonly) NSMutableArray* shapes;
@property (nonatomic, retain, readonly) NSMutableArray* shapeMatched;
...
- (void) setShapeMatched:(ShapeType)type;
@end
及其实现:
- (void) setShapeMatched:(ShapeType)type {
int index = 0;
if (shapes != nil)
{
for(Object2D* obj in shapes)
{
if (obj.figure == type)
{
[shapeMatched replaceObjectAtIndex:index
withObject:[NSNumber numberWithBool:YES]];
obj.withFillColor = YES;
break;
}
else
index++;
}
}
}
我收到以下警告:
Type of property 'shapeMatched' does not match type of accessor 'setShapeMatched:'
我该如何解决这个警告?
最佳答案
您需要将自定义setShapeMatched:
重命名为其他名称(例如setMyShapeMatched
)。 setShapeMatched:
已被用作您声明的属性的 setter 。
关于iphone - 属性 'shapeMatched'的类型与访问者 'setShapeMatched:'的类型不匹配,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8242446/