나는 프로그래밍/코코아 학습의 초기 단계에 있으며, 간단한 UI를 프로그래밍 방식으로 작성하여 코드/GUI 간의 관계를보다 잘 시각화하기로 결정했습니다. 지금까지 템플릿에 OS X의에서 내 유일한 수정 코코아의 기본 템플릿을 열 수 있습니다 Appdelegate.m에서 Appdelegate.h 에서NSWindow의 인스턴스를 프로그래밍 방식으로 NSWindow에 추가하기
@property NSButton *theButton;
및
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
CGRect buttonFrame;
buttonFrame = CGRectMake(20, 20, 15, 5);
self.theButton = [[NSButton alloc]initWithFrame:buttonFrame];
[self.theButton setTitle:@"test"];
[self.window addSubview:self.theButton];
}
합니다. 왜이
[self.window addSubview:self.theButton];
No visible @interface for 'NSWindow' declares the selector 'addSubview:'
입니다 :
그러나 나는 오류는 무엇입니까?
'self.window.view'입니까? – nhgrif