UIPopoverController不是一个颜色

时间:2015-09-25 17:37:36

标签: ios objective-c uitableview uipopovercontroller

有谁知道为什么会出现白色部分?我的视图已经是灰色的,但是有两个白色的部分

enter image description here

白人:箭头和最后的弹道!

[UPDATE]

这是调用popover的代码,并使箭头指向单击的按钮!

- (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];
 }

下一个是安装会话的地方:

//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];

    }
}

1 个答案:

答案 0 :(得分:0)

您可以创建一个自定义UIPopoverBackgroundView子类,用于设置所需箭头的属性。

popoverController.popoverBackgroundViewClass = [MyPopoverBackgroundView class];