Mac OS X 10.10: No way to tell if an NSPopover was detached

Originator:jacob
Number:rdar://18974363 Date Originated:13-Nov-2014 03:26 PM
Status:Open Resolved:
Product:OS X SDK Product Version:Mac OS X 10.10 (14A388a)
Classification:Enhancement Reproducible:Always
 
Summary:
Current API in OS X 10.10 doesn’t provide any notification that a popover was detached. There’s also no public way to query an NSPopover if it is displayed in an attached or detached way. Before that, I believe that “will close” notification fired for detached popover but not with the new API.

Steps to Reproduce:
Add NSPopover to an application. Break your head trying to find a way to differentiate attached and detached popovers.

Expected Results:
A notification to signal that a Popover was detached. In the worst case an property that gives the same information. It should be available in _flags ivar, based on the header file.

Actual Results:
No public API.

Currently, the best way that I found to see if a popover is attached is the following code. Yes, a horrible, behaviour-defined hack:
- (BOOL)isPopoverAttached:(NSPopover *)popover
{
    return [[popover.contentViewController.view.window standardWindowButton:NSWindowCloseButton] superview] == nil;
}

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!