开发者

How to display sheet contained by different NIB with separate sheetController

I need to open sheet from separate NIB and wants to use its separate controller awakeFromNib to configure sheet controls.Please let me know 开发者_如何学运维the best way to do that.I am using 10.5 API with XCODE 3.1.4


Sounds like you want to load the nib. It also sounds like NSWindowController would be of interest to you.


thanks for all to helped me. I finally, solve my sheet problem. Following is the step i have followed to show the sheet from seperate NIB.

  1. Create New NIB with panel/window having seperate UI.
  2. Created NSwindowController subclass for my Sheet.
  3. implemented - init method in sheet controll and initialize nib using initWithWindowNibName.
  4. changed the File's owner class to sheetcontroller in seperate nib.
  5. add the window reference to File's Owner window object to my panel/window in seperate NIB.
  6. imported sheetcontroller header into main app controller and finally use the following code to make the sheet working.

Profile Actions:

- (IBAction)showProfiles:(id)sender {
    ProfileSheetController *profileSheet =[[ProfileSheetController alloc] init];
    profileSheet.appController = self;
    [NSApp beginSheet:[profileSheet window]
       modalForWindow:window
        modalDelegate:self
       didEndSelector:NULL
          contextInfo:nil];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜