Frage

Possible Duplicate:
Separation between Header and first cell — In plain UITableView

When I have no tableHeaderView in tableView than all separator are visible. But if I create a custom tableHeaderView than first cell does not have a separator on top of the cell. Why does my custom tableHeaderView removes first separator? How can I put it back?

War es hilfreich?

Lösung

just make a label of height 2 and width 320 at the last of your custom header view and make label background color of your separator color and don't set any text to the lebel, this will work like a separator..

Andere Tipps

Here's the code to add a standard looking separator view to the bottom of a header view:

CGRect sepFrame = CGRectMake(0, headerView.frame.size.height-1, 320, 1);
seperatorView = [[[UIView alloc] initWithFrame:sepFrame] autorelease];
seperatorView.backgroundColor = [UIColor colorWithWhite:224.0/255.0 alpha:1.0];
[headerView addSubview:seperatorView];

If you're trying to make it look like a normal table view cell, you probably need to add one at the top of the header view too.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top