2012-12-15 134 views
3

我想做出NSPopover類似於此:更改NSPopover的外觀?

screenshot

所以我想覆蓋圖。

不幸的是我沒有在Apple文檔中找到任何東西。

@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 

然後,我可以繼承_NSPopoverWindow,這也是私有的,並覆蓋

+ (Class)frameViewClassForStyleMask:(unsigned long long)arg1;

我不能繼承它,因爲: 不過,我使用類轉儲確實發現了下面的私有類它是私人的.. 有沒有辦法繞過這個?

或者還有其他方法嗎?

+0

你可以用公共API來做到這一點。對於iPad,請考慮創建您自己的自定義UIPopover和iPhone/iPad,查看子類化UIView以顯示您的需求。 – Anton

+0

@Anton NSPopover是Mac OS X. – NSAddict

+0

是的,NSPopover是OS X.猜猜我以爲你是因爲某種原因詢問iPad的,所以我建議UIPopoverController :) – Anton

回答