El encabezado de la sección Tableview personalizado es todo negro

I have a tableview section header, for which I'd like to add a custom view. When the tableview loads, it appears black, shown here: http://postimage.org/image/luluolc57/ When I start scrolling, and the header "sticks" to the top of the screen/navbar, it becomes just how I want it - shown here http://postimage.org/image/lek98nxud/

Basically, I'd like this view to be transparent with this gray tinted circle on it, so the tableview background shows through. here's the respective code.

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return [[SummaryView alloc] init];
}


- (void)drawRect:(CGRect)rect
{
    CGRect tintSize = CGRectMake(0.0, 0.0, self.bounds.size.height, self.bounds.size.height);
    [[UIImage imageNamed:@"Circular Tint.png"] drawInRect:tintSize];
}

preguntado el 28 de agosto de 12 a las 09:08

What's the rest of your UITableViewDataSource / UITableViewDelegate implementation look like? I have a hunch but want to see more. -

1 Respuestas

Does it work as expected with a standard UILabel?

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UILabel* label = [[UILabel alloc] init];
    [label setText:@"TEST"];
    return label;
}

If it does, you can slowly try transitioning from that and see at what point the problem arises. It might be related to the size of your custom view when it is alloc and init. Maybe initWithFrame would solve it.

Respondido 28 ago 12, 10:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.