Objective c 更改NSPopover的外观?

Objective c 更改NSPopover的外观?,objective-c,macos,cocoa,nspopover,Objective C,Macos,Cocoa,Nspopover,我想制作一个类似于此的NSPopover: 所以我想改写这幅画 不幸的是,我没有在苹果的文档中找到任何东西。 但是,我确实使用类转储找到了以下私有类: @interface NSPopoverFrame : NSView { const void *_themeX; long long _popoverAppearance; NSImage *_dragImage; unsigned long long _anchorEdge; struct CGSiz

我想制作一个类似于此的NSPopover:

所以我想改写这幅画

不幸的是,我没有在苹果的文档中找到任何东西。 但是,我确实使用类转储找到了以下私有类:

@interface NSPopoverFrame : NSView
{
    const void *_themeX;
    long long _popoverAppearance;
    NSImage *_dragImage;
    unsigned long long _anchorEdge;
    struct CGSize _anchorSize;
    CDStruct_3c058996 _contentInset;
    struct CGPoint _anchorPoint;
    unsigned long long _previousAnchorEdge;
    struct CGPoint _previousAnchorPoint;
    unsigned int _windowFilter;
    struct {
        unsigned int useDragWindowAppearance:1;
        unsigned int hasActiveShadow:1;
        unsigned int hasShadow:1;
        unsigned int invalidateShadow:1;
        unsigned int hasWindowBackgroundBlur:1;
        unsigned int shouldBlurBackground:1;
        unsigned int shouldInsetForAnchor:1;
        unsigned int doingSolidFillHack:1;
    } _flags;
}

+ (struct CGRect)contentRectForFrameRect:(struct CGRect)arg1 styleMask:(unsigned long long)arg2;
+ (struct CGRect)frameRectForContentRect:(struct CGRect)arg1 styleMask:(unsigned long long)arg2;
+ (struct CGRect)contentRectForFrameRect:(struct CGRect)arg1 appearance:(long long)arg2 anchorSize:(struct CGSize)arg3 contentInset:(CDStruct_3c058996)arg4;
+ (struct CGRect)frameRectForContentRect:(struct CGRect)arg1 appearance:(long long)arg2 anchorSize:(struct CGSize)arg3 contentInset:(CDStruct_3c058996)arg4;
@property struct CGPoint anchorPoint; // @synthesize anchorPoint=_anchorPoint;
@property long long popoverAppearance; // @synthesize popoverAppearance=_popoverAppearance;
@property CDStruct_3c058996 contentInset; // @synthesize contentInset=_contentInset;
@property struct CGSize anchorSize; // @synthesize anchorSize=_anchorSize;
@property unsigned long long anchorEdge; // @synthesize anchorEdge=_anchorEdge;
- (struct CGRect)titlebarRect;
- (BOOL)_hasActiveDragTypes;
- (void)draggingEnded:(id)arg1;
- (void)concludeDragOperation:(id)arg1;
- (BOOL)performDragOperation:(id)arg1;
- (void)draggingExited:(id)arg1;
- (unsigned long long)draggingEntered:(id)arg1;
- (void)_markAnchorRectAsNeedingDisplay;
- (void)setFrameSize:(struct CGSize)arg1;
- (BOOL)_isBorderView;
- (void)_drawFrameShadowAndFlushContext:(id)arg1;
- (void)tileAndSetWindowShape:(BOOL)arg1;
- (void)shapeWindow;
- (void)_setFrameNeedsDisplay:(BOOL)arg1;
- (id)opaqueAncestor;
- (BOOL)isOpaque;
- (struct CGRect)dragRectForFrameRect:(struct CGRect)arg1;
- (void)_resetDragMargins;
- (void)_clearDragMargins;
- (double)_distanceFromToolbarBaseToTitlebar;
- (void)_hideToolbarWithAnimation:(BOOL)arg1;
- (void)_showToolbarWithAnimation:(BOOL)arg1;
- (BOOL)_toolbarIsManagedByExternalWindow;
- (BOOL)_toolbarIsHidden;
- (BOOL)_toolbarIsShown;
- (BOOL)_toolbarIsInTransition;
- (BOOL)_canHaveToolbar;
- (id)zoomButton;
- (id)minimizeButton;
- (id)closeButton;
- (unsigned long long)styleMask;
- (id)title;
- (void)_windowChangedKeyState;
- (void)drawRect:(struct CGRect)arg1;
- (struct CGPoint)_adjustedForBoundsAnchorPoint:(struct CGPoint)arg1 anchorEdge:(unsigned long long)arg2;
- (id)_getPopoverIfAvailable;
- (void)drawBackgroundInRect:(struct CGRect)arg1 ofView:(id)arg2 anchorEdge:(unsigned long long)arg3 anchorPoint:(struct CGPoint)arg4;
- (void)_drawHUDPopoverAppearanceInRect:(struct CGRect)arg1 anchorEdge:(unsigned long long)arg2 anchorPoint:(struct CGPoint)arg3;
- (void)_drawMinimalPopoverAppearanceInRect:(struct CGRect)arg1 anchorEdge:(unsigned long long)arg2 anchorPoint:(struct CGPoint)arg3;
- (struct CGImage *)_imageMaskForPath:(struct CGPath *)arg1 anchorEdge:(unsigned long long)arg2 anchorPoint:(struct CGPoint)arg3;
- (struct CGPath *)_newMinimalAppearancePathInBounds:(struct CGRect)arg1 anchorEdge:(unsigned long long)arg2 anchorPoint:(struct CGPoint)arg3 topCapOnly:(BOOL)arg4 arrowOffset:(double)arg5;
- (struct CGPath *)_newMinimalAppearancePathInBounds:(struct CGRect)arg1 anchorEdge:(unsigned long long)arg2 arrowPosition:(double)arg3 topCapOnly:(BOOL)arg4 arrowOffset:(double)arg5;
- (void)_setHasDragWindowAppearance:(BOOL)arg1;
- (BOOL)_hasDragWindowAppearance;
- (void)_tileAndRedisplay:(BOOL)arg1;
- (struct CGRect)contentRectForFrameRect:(struct CGRect)arg1 styleMask:(unsigned long long)arg2;
- (struct CGRect)frameRectForContentRect:(struct CGRect)arg1 styleMask:(unsigned long long)arg2;
- (void)_setDragImage:(id)arg1;
- (id)_dragImage;
- (void)dealloc;
- (void)_windowTransformAnimationDidEnd:(id)arg1;
- (void)_windowTransformAnimationWillBegin:(id)arg1;
- (void)viewDidMoveToWindow;
- (void)_loadTheme;
- (void)viewWillDraw;
@property BOOL shouldBlurBackground;
- (void)_setWindowBackgroundBlurIfNeeded;
- (BOOL)_canHaveBlur;
- (void)_invalidateShadow;
@property BOOL shouldInsetForAnchor; // @dynamic shouldInsetForAnchor;
- (id)initWithCoder:(id)arg1;
- (id)initWithFrame:(struct CGRect)arg1 styleMask:(unsigned long long)arg2 owner:(id)arg3;
- (id)initWithFrame:(struct CGRect)arg1;
- (void)_commonPopoverInit;

@end
然后我可以将
\u nspooverwindow
子类化,这也是私有的,并重写

+(类)frameViewClassForStyleMask:(无符号长-长)arg1

我不能将其子类化,因为它是私有的。。 有没有办法绕过这个


或者还有其他方法吗?

我在Github上找到了这个很棒的存储库:


完全符合我的要求。

您可以使用公共API实现这一点。对于iPad,考虑创建您自己的自定义UIPopover,对于iPhone/iPad,考虑将UIView子类化以显示您的需要。@Anton NSPopover是Mac OS X。是的,NSPopover是OS X。我想您是出于某种原因询问iPad的,所以我建议UIPopoverController:)您可以随时编写自己的,或者修改许多自由和开放源码软件重写中的一个。苹果的Popover从来就不是这样设计的(即使有自定义视图,也必须覆盖边框)。虽然我不想说它(因为我以前被烧死过),但它有一个非常好的、可定制的popover API。