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.
- Create New NIB with panel/window having seperate UI.
- Created NSwindowController subclass for my Sheet.
- implemented - init method in sheet controll and initialize nib using initWithWindowNibName.
- changed the File's owner class to sheetcontroller in seperate nib.
- add the window reference to File's Owner window object to my panel/window in seperate NIB.
- 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];
}
精彩评论