2013년 9월 26일 목요일

대화상자 띄우기


1. Xib 만들기
File - New - File - User Interface - Application
"Sample.xib"를 생성

2. File's owner 변경
Sample.xib를 클릭
File's owner 클릭
Identity Ispector 클릭
Custom Class의 Class를 대화상자를 호출할 클래스로 변경

3. 
@interface MyController : NSObject
{
}

@property (assign) IBOutlet NSWindow * calibration;

4.
@implementation MyController
@synthesize calibration = _calibration;


- (IBAction)onButtonCalibration:(id)sender;
{
    // Show Dialog Box
    if(!_calibration)
        [NSBundle loadNibNamed:@"calibration" owner:self];
    
    [NSApp beginSheet:self.calibration
       modalForWindow:[[NSApp delegate] window]
        modalDelegate:self
       didEndSelector:NULL
          contextInfo:NULL];
    
}


댓글 없음:

댓글 쓰기