【发布时间】:2015-02-24 06:04:27
【问题描述】:
当我查看 Cocoa Touch API 时,我可以在同一个头文件中找到一些与类别一起声明的类,例如
@interface NSArray : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
@property (readonly) NSUInteger count;
// and some other properties
@end
@interface NSArray (NSExtendedArray)
@property (readonly, copy) NSString *description;
// and some other properties
@end
现在我正在尝试对我的班级做同样的事情,如下所示:
@interface ARCTextbook : NSObject
@property (nonatomic) NSInteger ID;
@property (nonatomic) NSString *name;
@end
@interface ARCTextbook (Student)
@property (nonatomic) NSInteger studentID;
@property (nonatomic, getter=isUsed) BOOL used; // Used by a student?
@end
但是,当我尝试访问 studentID 或 used 属性时,出现无法识别的选择器错误。我错过了什么吗?
干杯。
【问题讨论】:
标签: ios objective-c