Search code examples
iosobjective-cuitableviewuipopovercontroller

UIPopoverController is not so with a color


Does anyone know why is appearing white part? My View is already gray, but gets two white pieces

enter image description here

whites: Arrow and final Popover!

[UPDATE]

this is the code that calls the popover and makes the arrow points to the button that was clicked!

- (void) buttonFilter {

    if (viewFilter == @"Artistas") {
        content = [self.storyboard instantiateViewControllerWithIdentifier:@"TipoArtistaViewController"]; // MUDAR PARA O NOVO FILTRO DE ARTISTAS
    } else if (viewFilter == @"Músicas") {
        content = [self.storyboard instantiateViewControllerWithIdentifier:@"CategoriaViewController"];
    }

    [self callFilter:btnFilter Filter:content];
}

- (void)callFilter:(id)sender Filter:(UIViewController *) content{
    self.currentPop = popoverController;

    popoverController = [[WYPopoverController alloc] initWithContentViewController:content];

    UIButton * bt = (UIButton * )sender;
    UIView *view = [bt valueForKey:@"view"];
    popoverController.popoverContentSize = CGSizeMake(320, 180);
    popoverController.delegate = self;
    [popoverController presentPopoverFromRect:view.bounds inView:view permittedArrowDirections:WYPopoverArrowDirectionAny animated:YES];
 }

the next is where to mount the session:

//extend and collpase
- (void)setupViewController {

    categoriaBD = [categoriaDAO selectCategoria];


    self.data = [[NSMutableArray alloc] init];
    for (int i = 0; i < [categoriaBD count]; i++)
    {
        NSMutableDictionary * teste = [categoriaBD objectForKey:[NSString stringWithFormat:@"%i", i]];
        ID = [[teste objectForKey:@"1"] integerValue];
        subcategoriaBD = [categoriaDAO selectSubCategoriaByCategoriaID:ID];

        NSMutableArray* section = [[NSMutableArray alloc] init];
        for (int j = 0; j < [subcategoriaBD count]; j++)
        {
            NSMutableDictionary * subCat = [subcategoriaBD objectForKey:[NSString stringWithFormat:@"%i", j]];
            [section addObject:[NSString stringWithFormat:[subCat objectForKey:@"1"]]];
        }
        [self.data addObject:section];                      
    }

    self.headers = [[NSMutableArray alloc] init];
    for (int i = 0; i < [categoriaBD count]; i++)
    {

        NSString *inStr = [NSString stringWithFormat: @"%i", (int)i];
        nomeCategoria = [categoriaBD objectForKey:inStr];

        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 310, 40)];
        [label setText:[nomeCategoria objectForKey:@"2"]];

        UIView* header = [[UIView alloc] init];

        [header setBackgroundColor:[UIColor colorWithRed:(226/255.0) green:(226/255.0) blue:(226/255.0) alpha:1]];
        [header addSubview:label];
        [self.headers addObject:header];

    }
}

Solution

  • You can to create a custom UIPopoverBackgroundView subclass that sets the properties of the arrow you want.

    popoverController.popoverBackgroundViewClass = [MyPopoverBackgroundView class];