0
私は子供のクラスによって変更されるため、必要な単純なメソッドをカプセル化するように設計された、以下の形式のカテゴリを持っています。このカテゴリをClassOneTests.m
,ClassOneA.h, .m
、ClassOneB.h, .m
などの他のクラスにインポートするにはどうすればよいですか? #import "ClassOne+MyCategory.h"
エラーを示します。objective-cの親クラス内で定義されたカテゴリをどのようにインポートしますか?
ClassOne.m
#import "ClassOne.h"
@interface ClassOne()
-(void)MethodOne
@end
@interface ClassOne (MyCategory)
-(NSString *)servantToMethodOne
@end
@implementation ClassOne
-(void)MethodOne {
[self servantToMethodOne];
...
}
@end
@implementation ClassOne (MyCategory)
...
@end