このカテゴリを CPView に追加しようとしていますが、XCodeCapp でエラーがunrecognized selector sent to instance発生し、このメソッドを使用しようとするとエラーが発生します。
@import <AppKit/CPView.j>
@implementation CPView (Custom)
- (void) addSomething
{
var bounds = [self bounds];
var context = [[CPGraphicsContext currentContext] graphicsPort];
CGContextSetFillColor(context, [CPColor blueColor]);
CGContextFillRect(context, CGRectMake(100,100,100,100));
}
@end
私が知る限り、構文は正しいです。私が使用しているファイル名は CPView_Custom.j です
編集
また、IB を使用して CPView ivar を XIB/NIB ファイルのカスタム ビューに接続しています。これが違いを生むかどうかはわかりません。