我正在尝试将此类别添加到 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 文件中的自定义视图。不确定这是否有所作为。