我真的希望我能更具体,但不幸的是,我不能。所有适当的对象都是非零的,并且所有适当的方法调用都(可能)成功地进行了,但我的NSPopover
只是从未出现过。也没有调用任何委托方法。
// ivars
NSPopover *tagPopover;
NSViewController *tagPopoverViewController;
// in method to display popover
tagPopover = [[NSPopover alloc] init];
[tagPopover setBehavior: NSPopoverBehaviorApplicationDefined];
[tagPopover setDelegate: self];
tagPopoverViewController = [[MYViewController alloc] initWithNibName: @"MYViewController" bundle: nil];
[tagPopover setContentViewController: tagPopoverViewController];
[tagPopover setContentSize: tagPopoverViewController.view.frame.size];
[tagPopover showRelativeToRect: NSMakeRect(700, 400, 5, 5) // Screen coordinates
ofView: [[NSApp keyWindow] contentView]
preferredEdge: NSMinYEdge];