2
我想將此類別添加到CPView,但XCodeCapp提供了一個錯誤,當我嘗試使用此方法時出現unrecognized selector sent to instance
錯誤。不能將類別添加到CPView卡布奇諾
@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伊娃連接到一個自定義在XIB/NIB文件中查看。不知道這是否有所作爲。
你是如何導入它? – 2012-03-15 00:30:36
'@import「CPView_Custom.j」'在AppController.j頂部 – 2012-03-15 00:32:15
對我來說很好。嘗試將代碼移動到您使用它的文件中。如果有效,那麼問題將與導入相關。 – 2012-03-15 00:36:17