Arcadian
Arcadian

Reputation: 4350

How to remove the "fuzzy" drop shadow in the UIPopoverController

I don't want the drop shadow when the UIPopoverController's view appears. Is there a way to remove this drop shadow look?

Upvotes: 5

Views: 6059

Answers (3)

Oriol
Oriol

Reputation: 635

You just have to use your custom UIPopoverBackgroundView and there implement this function:

+ (BOOL)wantsDefaultContentAppearance {
    return NO;
}

Upvotes: 0

niko34
niko34

Reputation: 276

Not straight forward, but since iOS 5, you can make your own custom popover background using UIPopoverBackgroundView.

See the answer for this question: Using UIPopoverBackgroundView class. It's pointing to a good tuto.

Then, in the initWithFrame of your UIPopoverBackgroundView implementation, you can use a clearColor for the drop shadow. Using offset and radius did not work for me.

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        self.layer.shadowColor = [[UIColor clearColor] CGColor];
    }
    return self;
}

Upvotes: 12

Caleb
Caleb

Reputation: 124997

The shadow is an attribute of the popover view's layer. If you could get access to the layer, you could set it's shadow radius to 0.0 and shadow offset to {0.0, 0.0}. However, it looks like the view must be a private ivar of the popover controller, so there's not an easy way to get to it. Moreover, if you're looking to distribute this app through the app store, using a private ivar and changing the look of standard UI elements both are likely to get your app rejected.

Upvotes: 0

Related Questions