@@ -93,7 +93,10 @@ - (void)sizzled_pushViewController:(UIViewController *)viewController animated:(
9393 if (self.isEmbedInPopover )
9494 {
9595#ifdef WY_BASE_SDK_7_ENABLED
96- viewController.edgesForExtendedLayout = UIRectEdgeNone;
96+ if ([viewController respondsToSelector: @selector (setEdgesForExtendedLayout: )])
97+ {
98+ viewController.edgesForExtendedLayout = UIRectEdgeNone;
99+ }
97100#endif
98101 }
99102
@@ -328,6 +331,7 @@ @interface WYPopoverInnerView : UIView
328331
329332@property (nonatomic , assign ) CGFloat navigationBarHeight;
330333@property (nonatomic , assign ) BOOL wantsDefaultContentAppearance;
334+ @property (nonatomic , assign ) CGFloat borderWidth;
331335
332336@end
333337
@@ -352,6 +356,7 @@ @implementation WYPopoverInnerView
352356
353357@synthesize navigationBarHeight;
354358@synthesize wantsDefaultContentAppearance;
359+ @synthesize borderWidth;
355360
356361- (id )initWithFrame : (CGRect)frame
357362{
@@ -386,7 +391,7 @@ - (void)drawRect:(CGRect)rect
386391
387392 UIBezierPath* roundedRectPath = [UIBezierPath bezierPathWithRoundedRect: innerRect cornerRadius: cornerRadius + 1 ];
388393
389- if (wantsDefaultContentAppearance == NO )
394+ if (wantsDefaultContentAppearance == NO && borderWidth > 0 )
390395 {
391396 CGContextSaveGState (context);
392397 {
@@ -404,14 +409,19 @@ - (void)drawRect:(CGRect)rect
404409
405410 CGContextSaveGState (context);
406411 {
407- if (wantsDefaultContentAppearance == NO )
412+ if (wantsDefaultContentAppearance == NO && borderWidth > 0 )
408413 {
409414 [roundedRectPath addClip ];
410415 CGContextSetShadowWithColor (context, innerShadowOffset, innerShadowBlurRadius, innerShadowColor.CGColor );
411416 }
412417
413418 UIBezierPath* inRoundedRectPath = [UIBezierPath bezierPathWithRoundedRect: CGRectInset (innerRect, 0.5 , 0.5 ) cornerRadius: cornerRadius];
414419
420+ if (borderWidth == 0 )
421+ {
422+ inRoundedRectPath = [UIBezierPath bezierPathWithRoundedRect: CGRectInset (innerRect, 0.5 , 0.5 ) byRoundingCorners: UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii: CGSizeMake (cornerRadius, cornerRadius)];
423+ }
424+
415425 [self .innerStrokeColor setStroke ];
416426 inRoundedRectPath.lineWidth = 1 ;
417427 [inRoundedRectPath stroke ];
@@ -781,6 +791,7 @@ - (void)setViewController:(UIViewController *)viewController
781791 innerView.innerShadowOffset = innerShadowOffset;
782792 innerView.innerCornerRadius = self.innerCornerRadius ;
783793 innerView.innerShadowBlurRadius = innerShadowBlurRadius;
794+ innerView.borderWidth = self.borderWidth ;
784795 }
785796
786797 innerView.navigationBarHeight = navigationBarHeight;
@@ -835,6 +846,11 @@ - (CGFloat)innerCornerRadius
835846 if (borderWidth == 0 )
836847 {
837848 result = 0 ;
849+
850+ if (outerCornerRadius > 0 )
851+ {
852+ result = outerCornerRadius;
853+ }
838854 }
839855
840856 return result;
@@ -1015,6 +1031,18 @@ - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context
10151031
10161032 reducedOuterCornerRadius = MIN (reducedOuterCornerRadius, outerCornerRadius);
10171033
1034+ /*
1035+ if (borderWidth == 0 && outerCornerRadius > 0)
1036+ {
1037+ if ()
1038+ {
1039+ result = outerCornerRadius;
1040+ }
1041+ }
1042+ */
1043+
1044+ NSLog (@" outerCornerRadius = %f " , outerCornerRadius);
1045+
10181046 if (arrowDirection == WYPopoverArrowDirectionUp)
10191047 {
10201048 origin = CGPointMake (CGRectGetMidX (outerRect) + arrowOffset - arrowBase / 2 , CGRectGetMinY (outerRect));
@@ -1603,7 +1631,12 @@ - (void)setPopoverNavigationBarBackgroundImage
16031631 if ([navigationController viewControllers ] && [[navigationController viewControllers ] count ] > 0 )
16041632 {
16051633#ifdef WY_BASE_SDK_7_ENABLED
1606- [(UIViewController *)[[navigationController viewControllers ] objectAtIndex: 0 ] setEdgesForExtendedLayout: UIRectEdgeNone];
1634+ UIViewController *firstViewController = (UIViewController *)[[navigationController viewControllers ] objectAtIndex: 0 ];
1635+
1636+ if ([firstViewController respondsToSelector: @selector (setEdgesForExtendedLayout: )])
1637+ {
1638+ [firstViewController setEdgesForExtendedLayout: UIRectEdgeNone];
1639+ }
16071640#endif
16081641 }
16091642
0 commit comments