나는 약간의 문제가있어 당신이 나를 도울 수 있기를 바랍니다.콘센트 및 인스턴스 메서드
//AppDelegate.h
#import <Cocoa/Cocoa.h>
@class MainView;//The main window
@interface DownloadedAppDelegate : NSObject <NSApplicationDelegate> {
IBOutlet MainView*mainview;//the objects are in the same nib, outlet connected with the window
}
@property(nonatomic,retain) IBOutlet MainView*mainview;
@end
을 : 나는 서브 클래 싱 된 윈도우의 인스턴스 메서드를 호출하고 거기 사용자 인터페이스를 설정합니다.
//AppDelegate.m
#import "MainView.h"
@synthesize mainview;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[mainview launched];//But sometimes this code fails, I don't know why
//launched sets up the interface
}
-(void)dealloc {
mainview=nil;
}
MainView는 NSWindow에 속합니다.
개선 할 점이 있습니까? UI를 다른 곳에 구축해야합니까? 왜이 코드가 항상 작동하지 않는지 아십니까?
답변 해 주셔서 감사합니다. 당신이 처음 이었기 때문에 나는 그것을 받아 들였습니다. – user610246