SlideShare uma empresa Scribd logo
1 de 22
12. NIB 파일과
NSWINDOWCONTROLLER
NSWindowController
NSApplication 은 MainMenu.nib 로딩.
RMDocument 는 RMDocument.nib 로딩.
NSWindowController 를 사용해서
직접 NIB 파일 로딩.
왜?
Lazy-loading 으로 인한 효율.(환경설정, 찾기...)
NSPanel - 환경 설정
패널은 보조 용도
패널은 키 윈도가 될 수 있지만
메인 윈도는 될 수 없다.
"윈도우" 메뉴에 나타나지 않는다.
hidesOnDeactivate 를 대부분 YES로 설정.
패널 추가
NSWindowController
NSWindowController 를
상속한 PreferenceController 생성.
NSObject 를 상속한 AppController 생성.
패널 보여주기
Lazy-loading
nil 일 경우, 인스턴스 생성하여 보여줌.
XIB 추가
File's Owner 설정
File's Owner
많은 사람들이 File's Owner를 사용하는 것에 혼란.
File's Owner is the controller object
that is responsible for the contents of the nib file.
소유자가 PreferenceController 임을 NIB 파일에 명시.
코드 연결
NSBundle
번들(bundle)은 자원 디렉토리로
어플리케이션에서 사용
그림, 소리, 컴파일된 코드, NIB...
다국어 지원(English.lproj, Korean.lproj) 디렉토리.
NSBundle
NSBundle *myBundle = [NSBundle mainBundle];
NSBundle *goodBundle;
goodBundle = [NSBundle bundleWithPath:@"~/..."];
NSString *path = [goodBundle pathForImageResource:@"Mom"];
NSImage *momPhoto = [[NSImage alloc] initWithContentsOfFile:path];
코드 라이브러리
Class newClass = [goodBundle classNamed:@"Rover"];
id newInstance = [[newClass alloc] init];
Class aClass = [goodBundle principalClass];
id anInstance = [[aClass alloc] init];
The principal class typically controls all the other
classes in the bundle.
NIB 열기
NSWindowController 없이 NIB 파일 열기.
BOOL successful =
[NSBundle loadNibNamed:@"About" owner:someObject];
someObject 는 File's Owner로 동작.

Mais conteúdo relacionado

Mais de Kyungryul KIM

전문검색기술도전
전문검색기술도전전문검색기술도전
전문검색기술도전Kyungryul KIM
 
서버인프라를지탱하는기술5 1 2
서버인프라를지탱하는기술5 1 2서버인프라를지탱하는기술5 1 2
서버인프라를지탱하는기술5 1 2Kyungryul KIM
 
Chaper24 languages high_and_low
Chaper24 languages high_and_lowChaper24 languages high_and_low
Chaper24 languages high_and_lowKyungryul KIM
 
Ch22 운영체제
Ch22 운영체제Ch22 운영체제
Ch22 운영체제Kyungryul KIM
 

Mais de Kyungryul KIM (20)

Node ch12
Node ch12Node ch12
Node ch12
 
11.scripting
11.scripting11.scripting
11.scripting
 
32 osx app_release
32 osx app_release32 osx app_release
32 osx app_release
 
Meteor ddp
Meteor ddpMeteor ddp
Meteor ddp
 
Cocos2dx 7.1-7.2
Cocos2dx 7.1-7.2Cocos2dx 7.1-7.2
Cocos2dx 7.1-7.2
 
Cocos2 d x-7.3_4
Cocos2 d x-7.3_4Cocos2 d x-7.3_4
Cocos2 d x-7.3_4
 
Cocos2d x-ch5-1
Cocos2d x-ch5-1Cocos2d x-ch5-1
Cocos2d x-ch5-1
 
Coco2d x
Coco2d xCoco2d x
Coco2d x
 
23 drag drop
23 drag drop23 drag drop
23 drag drop
 
Hadoop ch5
Hadoop ch5Hadoop ch5
Hadoop ch5
 
전문검색기술도전
전문검색기술도전전문검색기술도전
전문검색기술도전
 
Dsas
DsasDsas
Dsas
 
서버인프라를지탱하는기술5 1 2
서버인프라를지탱하는기술5 1 2서버인프라를지탱하는기술5 1 2
서버인프라를지탱하는기술5 1 2
 
Chaper24 languages high_and_low
Chaper24 languages high_and_lowChaper24 languages high_and_low
Chaper24 languages high_and_low
 
Ch22 운영체제
Ch22 운영체제Ch22 운영체제
Ch22 운영체제
 
Mibis ch20
Mibis ch20Mibis ch20
Mibis ch20
 
Mibis ch15
Mibis ch15Mibis ch15
Mibis ch15
 
Mibis ch8
Mibis ch8Mibis ch8
Mibis ch8
 
Mibis ch4
Mibis ch4Mibis ch4
Mibis ch4
 
14 strategy design
14 strategy design14 strategy design
14 strategy design
 

Nib_NSWindowController