문제

Following is a snapshot of my popover:

enter image description here

I have an UIViewController (say A) that I want to show as popoverController. Also I want to customize popover so I am customizing the UIPopoverBackgroundView (say 'b' - orange background). Everything is working right except that after rounding the corners of A.view and 'b' I have a rectangular shadow line (which from the snapshot probably belongs to A.view - green background). Based on UIView or UIViewController APIs, is there any way I can remove that shadow. I am only interested in removing the black line on left, top and right of the view not the fuzzy looking shadow.

I did try:

[A.view.layer setShadowOpacity:0.0];

but no luck.

도움이 되었습니까?

해결책

In your UIPopoverBackgroundView subclass, override the class method:

+ (BOOL)wantsDefaultContentAppearance

To return NO. This prevents the drawing of the inner shadow as documented here.

다른 팁

Remove the call for [super layoutSubviews] in your layoutSubviews method.

Overriding wantsDefaultContentAppearance and returning NO did not work for me.

You cannot control the shadow of a UIPopoverController directly. Your options are:

  1. Roll your own kind of popover.
  2. Subclass UIPopoverBackgroundView and provide your own graphics for the frame of the popover. Contrary to the official documentation, the shadow doesn't get drawn on for you when you subclass UIPopoverBackgroundView. Here's a great post on how to do this: http://blog.andrewkolesnikov.com/custom-background-color-tint-for-uipopover-64835
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top