0

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];
        }
    }
Carl Veazey
  • 18,392
  • 8
  • 66
  • 81
PhilBot
  • 748
  • 18
  • 85
  • 173

2 Answers2

1

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.

Kumar Aditya
  • 1,097
  • 1
  • 8
  • 19
  • So I found this: https://github.com/ddebin/DDPopoverBackgroundView. But can I use this with interface builder? I can't seem to figure out how to set the popoverBackgroundViewClass in interface builder. – PhilBot Nov 10 '13 at 16:06
0

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];
        }
PhilBot
  • 748
  • 18
  • 85
  • 173