ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Nib 파일의 File's Owner 객체란 ?
    프로그래밍/아이폰 프로그래밍 2010. 2. 11. 15:12



    File's Owner 는  인터페이스 빌더상에 기본적으로 나오는 인스턴스화 된 객체로 Nib 파일 자체의

    소유자를 의미한다.

    NSBundle 를 이용하여 Nib 파일을 로드할 경우 File's Owner 는 아래의 owner: 파라미터와

    동일한 객체를 가리킨다.

    + (BOOL)loadNibNamed:(NSString *)aNibName owner:(id)owner



    이와는 달리  NSWindowController 를 사용하는 경우는 아래와 같은 코드를 활용하여

    NSBundle 클래스의 도움없이 특정 Nib 파일을 간편하게 로딩할 수 있다.

    @interface ERSubjectAreaController : NSWindowController {

        IBOutlet id _subjectAreaView;
        IBOutlet id _mouseAxisLabel;
        IBOutlet id _newEntityButton;
    }

    @end



    @implementation ERSubjectAreaController

    - (id)init
    {
        // NSWindowController 클래스의 initWithWindowNibName 메시지를 이용하여
        // ERSubjectArea.nib 파일을 로딩하는 코드이다.
        // NSWindowConntroll 역시 내부적으로는 NSBundle 을 활용하여 Nib 파일을 로딩한다.
     
        if(self = [super initWithWindowNibName:@"ERSubjectArea"]) {
        }
       
        return self;
    }
    - (void)dealloc
    {

        [super dealloc];
    }


    - (void)awakeFromNib
    {
        [_subjectAreaView setController:self];
    }


    @end

    댓글