@@ -489,8 +489,6 @@ - (id)initWithContentSize:(CGSize)contentSize;
489489
490490- (BOOL )isTouchedAtPoint : (CGPoint)point ;
491491
492- - (void )redraw ;
493-
494492@end
495493
496494// //////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -531,27 +529,29 @@ @implementation WYPopoverBackgroundView
531529
532530+ (void )load
533531{
534- WYPopoverBackgroundView* appearance = [WYPopoverBackgroundView appearance ];
535- appearance.tintColor = nil ;
536- appearance.strokeColor = nil ;
537- appearance.fillTopColor = nil ;
538- appearance.fillBottomColor = nil ;
539- appearance.glossShadowColor = nil ;
540- appearance.glossShadowOffset = CGSizeMake (0 , 1.5 );
541- appearance.glossShadowBlurRadius = 0 ;
542- appearance.borderWidth = 6 ;
543- appearance.arrowBase = 42 ;
544- appearance.arrowHeight = 18 ;
545- appearance.outerShadowColor = [UIColor colorWithWhite: 0 alpha: 0.75 ];
546- appearance.outerShadowBlurRadius = 8 ;
547- appearance.outerShadowOffset = CGSizeMake (0 , 2 );
548- appearance.outerCornerRadius = 8 ;
549- appearance.minOuterCornerRadius = 0 ;
550- appearance.innerShadowColor = [UIColor colorWithWhite: 0 alpha: 0.75 ];
551- appearance.innerShadowBlurRadius = 2 ;
552- appearance.innerShadowOffset = CGSizeMake (0 , 1 );
553- appearance.innerCornerRadius = 6 ;
554- appearance.viewContentInsets = UIEdgeInsetsMake (3 , 0 , 0 , 0 );
532+ @autoreleasepool {
533+ WYPopoverBackgroundView* appearance = [WYPopoverBackgroundView appearance ];
534+ appearance.tintColor = nil ;
535+ appearance.strokeColor = nil ;
536+ appearance.fillTopColor = nil ;
537+ appearance.fillBottomColor = nil ;
538+ appearance.glossShadowColor = nil ;
539+ appearance.glossShadowOffset = CGSizeMake (0 , 1.5 );
540+ appearance.glossShadowBlurRadius = 0 ;
541+ appearance.borderWidth = 6 ;
542+ appearance.arrowBase = 42 ;
543+ appearance.arrowHeight = 18 ;
544+ appearance.outerShadowColor = [UIColor colorWithWhite: 0 alpha: 0.75 ];
545+ appearance.outerShadowBlurRadius = 8 ;
546+ appearance.outerShadowOffset = CGSizeMake (0 , 2 );
547+ appearance.outerCornerRadius = 8 ;
548+ appearance.minOuterCornerRadius = 0 ;
549+ appearance.innerShadowColor = [UIColor colorWithWhite: 0 alpha: 0.75 ];
550+ appearance.innerShadowBlurRadius = 2 ;
551+ appearance.innerShadowOffset = CGSizeMake (0 , 1 );
552+ appearance.innerCornerRadius = 6 ;
553+ appearance.viewContentInsets = UIEdgeInsetsMake (3 , 0 , 0 , 0 );
554+ }
555555}
556556
557557- (id )initWithContentSize : (CGSize)aContentSize
@@ -569,7 +569,12 @@ - (id)initWithContentSize:(CGSize)aContentSize
569569 self.arrowOffset = 0 ;
570570
571571 self.layer .name = @" parent" ;
572- self.layer .drawsAsynchronously = YES ;
572+
573+ if (WYPOPOVER_IS_IOS_GREATER_THAN_OR_EQUAL_TO (@" 6.0" ))
574+ {
575+ self.layer .drawsAsynchronously = YES ;
576+ }
577+
573578 self.layer .contentsScale = [UIScreen mainScreen ].scale ;
574579 // self.layer.edgeAntialiasingMask = kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge;
575580 self.layer .delegate = self;
@@ -677,7 +682,7 @@ - (void)setViewController:(UIViewController *)viewController
677682
678683 innerView.frame = contentView.frame ;
679684
680- [self redraw ];
685+ [self .layer setNeedsDisplay ];
681686}
682687
683688- (CGSize)sizeThatFits : (CGSize)size
@@ -790,18 +795,14 @@ - (UIColor*)fillBottomColor
790795 return result;
791796}
792797
793- - (void )redraw
794- {
795- [self .layer setNeedsDisplay ];
796- // if (innerLayer) [innerLayer setNeedsDisplay];
797- }
798-
799798#pragma mark Drawing
800799
801800- (void )setNeedsDisplay
802801{
803802 [super setNeedsDisplay ];
804803
804+ [self .layer setNeedsDisplay ];
805+
805806 if (innerView)
806807 {
807808 innerView.navigationBarHeight = navigationBarHeight;
@@ -1158,6 +1159,7 @@ @interface WYPopoverController () <WYPopoverOverlayViewDelegate>
11581159 BOOL isInterfaceOrientationChanging;
11591160 __weak UIBarButtonItem* barButtonItem;
11601161 CGRect keyboardRect;
1162+ BOOL hasAppearanceProxyAvailable;
11611163}
11621164
11631165@property (nonatomic , strong , readonly ) UIView *rootView;
@@ -1283,6 +1285,34 @@ - (void)presentPopoverFromRect:(CGRect)aRect inView:(UIView *)aView permittedArr
12831285 [self .rootView addSubview: overlayView];
12841286 }
12851287
1288+ if (WYPOPOVER_IS_IOS_LESS_THAN (@" 6.0" ) && hasAppearanceProxyAvailable == NO )
1289+ {
1290+ hasAppearanceProxyAvailable = YES ;
1291+
1292+ WYPopoverBackgroundView* appearance = [WYPopoverBackgroundView appearance ];
1293+
1294+ containerView.tintColor = appearance.tintColor ;
1295+ containerView.strokeColor = appearance.strokeColor ;
1296+ containerView.fillTopColor = appearance.fillTopColor ;
1297+ containerView.fillBottomColor = appearance.fillBottomColor ;
1298+ containerView.glossShadowColor = appearance.glossShadowColor ;
1299+ containerView.glossShadowOffset = appearance.glossShadowOffset ;
1300+ containerView.glossShadowBlurRadius = appearance.glossShadowBlurRadius ;
1301+ containerView.borderWidth = appearance.borderWidth ;
1302+ containerView.arrowBase = appearance.arrowBase ;
1303+ containerView.arrowHeight = appearance.arrowHeight ;
1304+ containerView.outerShadowColor = appearance.outerShadowColor ;
1305+ containerView.outerShadowBlurRadius = appearance.outerShadowBlurRadius ;
1306+ containerView.outerShadowOffset = appearance.outerShadowOffset ;
1307+ containerView.outerCornerRadius = appearance.outerCornerRadius ;
1308+ containerView.minOuterCornerRadius = appearance.minOuterCornerRadius ;
1309+ containerView.innerShadowColor = appearance.innerShadowColor ;
1310+ containerView.innerShadowBlurRadius = appearance.innerShadowBlurRadius ;
1311+ containerView.innerShadowOffset = appearance.innerShadowOffset ;
1312+ containerView.innerCornerRadius = appearance.innerCornerRadius ;
1313+ containerView.viewContentInsets = appearance.viewContentInsets ;
1314+ }
1315+
12861316 [self positionPopover ];
12871317
12881318 // default content appearance ?
0 commit comments