Search code examples
objective-cuiviewios6xcode4.3uipopovercontroller

UIPopoverController's UIView: How to remove shadow?


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.


Solution

  • In your UIPopoverBackgroundView subclass, override the class method:

    + (BOOL)wantsDefaultContentAppearance
    

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