Question

I've successfully hooked up several popover views in interface builder. I've tried to make the background black by setting the view background color to black, but I am still getting a white arrow on the popover itself and white artifacts on the 4 rounded corners.

Please see the screenshot.

enter image description here

What can I do to make the background totally black in interface builder?

I appreciate the answer below but I still can't quite get it to work - here is my code:

// Show the satellite Ephemeris
    if ( itemIndex == 1 ) {

        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            NSLog(@"This is an iPad - Creating popover!");
            EphemerisDataView *ephemView = [[EphemerisDataView alloc] init];
            UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:ephemView];
            [popOver setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
            [popOver.popoverBackgroundViewClass setTintColor:[UIColor blackColor]];
            CGSize size = CGSizeMake(320, 480); // size of view
            popOver.popoverContentSize = size;
            [popOver presentPopoverFromRect:self.popOverAnchor.bounds inView:self.view
                             permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

        }
        else {
            NSLog(@"This is not an iPad - Performing segue...");
            // Show the next view
            [self performSegueWithIdentifier:@"Ephemeris" sender:self];
        }
    }
Was it helpful?

Solution 2

Do it like this:

        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {

            NSLog(@"This is an iPad - Creating popover!");
            UIStoryboard *storyboard = [UIStoryboard storyboardWithName: @"MainStoryboard_iPad" bundle:[NSBundle mainBundle]];
            EphemerisDataView *ephemView = [storyboard instantiateViewControllerWithIdentifier:@"EphemerisDataView"];
            UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:ephemView];
            self.customPopoverController = popOver;
            [popOver setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
            [popOver.popoverBackgroundViewClass setTintColor:[UIColor blackColor]];
            popOver.delegate = self;
            CGSize size = CGSizeMake(320, 480); // size of view
            popOver.popoverContentSize = size;
            [popOver presentPopoverFromRect:self.popOverAnchor.bounds inView:self.popOverAnchor
                             permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

        }
        else {
            NSLog(@"This is not an iPad - Performing segue...");
            // Show the next view
            [self performSegueWithIdentifier:@"Ephemeris" sender:self];
        }

OTHER TIPS

You cannot customize that arrow by IB. You will need a totally customized popover for you. Plenty of them are available on git. But If you want to use default one then it is not possible to customize that arrow as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top