0

I would like to create a popover with white color border. I have done by assigning instance of subclass to popoverBackgroundViewClass. I am able to achieve this with white color (using white image at the background )but with border of the popover is not removed. A white color border Still appears. Is there any way to remove it?

Sankar Ganesh PMP
  • 11,927
  • 11
  • 57
  • 90
DilipKumar
  • 11
  • 5

2 Answers2

2

Yes, there is one crazy solution ) After you presentPopover, you need call this method

-(void)removeInnerShadow {
UIWindow *window = [[[UIApplication sharedApplication] delegate] window];

for (UIView *windowSubView in window.subviews) {
    if ([NSStringFromClass([windowSubView class]) isEqualToString:@"UIDimmingView"]) {
        for (UIView *dimmingViewSubviews in windowSubView.subviews) {
            for (UIView *popoverSubview in dimmingViewSubviews.subviews) {
                if([NSStringFromClass([popoverSubview class]) isEqualToString:@"UIView"]) {
                    for (UIView *subviewA in popoverSubview.subviews) {
                        if ([NSStringFromClass([subviewA class]) isEqualToString:@"UILayoutContainerView"]) {
                            subviewA.layer.cornerRadius = 0;
                        }

                        for (UIView *subviewB in subviewA.subviews) {
                            if ([NSStringFromClass([subviewB class]) isEqualToString:@"UIImageView"] ) {
                                [subviewB removeFromSuperview];
                            }
                            if ([NSStringFromClass([subviewB class]) isEqualToString:@"UILayoutContainerView"] ) {
                                for (UIView *subviewC in subviewB.subviews) {
                                    if ([NSStringFromClass([subviewC class]) isEqualToString:@"UIImageView"]) {
                                        [subviewC removeFromSuperview];
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
}
Philip J. Fry
  • 1,165
  • 1
  • 8
  • 10
0

You can try this library https://github.com/ddebin/DDPopoverBackgroundView

UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:content];
[popOver setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];

just set

[popOver.popoverBackgroundViewClass setContentInset:0.0f];

thats it. But remember this will only work on iOS 5+

Rohit Khandelwal
  • 1,778
  • 15
  • 23
Kshitiz Ghimire
  • 1,716
  • 3
  • 18
  • 37