Separation Between Header and First Cell -- in Plain Uitableview

Separation between Header and first cell -- In plain UITableView

Custom headers and footers do not contain separators below/above them. You'll need to implement the separator yourself in the custom view (or switch to grouped style, which will show the outline of the group above and below it even with a custom header/footer).

Space Between Sections in UITableview

Did you try override this function:

override func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return .leastNormalMagnitude
}

iOS 7 UITableView: How to remove space between navigation bar and first cell

Just add this in you ViewDidLoad method

self.automaticallyAdjustsScrollViewInsets = NO;

Create space between section header and cell

You can't add space between but you can make the header height bigger and make the contents of the header not go all the way to the bottom of it.

iPhone UITableView : How to remove the spacing between sections in group style table?

Try this..

   self.tableView.rowHeight = 0; // in viewdidload
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; // in viewdidload

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.01f;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return <your header height>;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
return [[UIView alloc] initWithFrame:CGRectZero];
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
return <your header view>;
}

Also have table seprator as none.

How do I add a separator line for a custom UITableView header section nib?

Maybe you need to add a seperator yourself like this :

CGRect seperatorFrame = CGRectMake(0, headerView.frame.size.height-1, tableView.bounds.size.width, 1);
UIView *seperatorView = [[UIView alloc] initWithFrame:seperatorFrame];
seperatorView.backgroundColor = [UIColor grayColor];
[headerView addSubview:seperatorView];

or use Autolayout in .xib:

xib autolayout

Reducing the space between sections of the UITableView

It was a bit tricky, but try this code:

- (CGFloat)tableView:(UITableView*)tableView 
heightForHeaderInSection:(NSInteger)section {
if (section == 0) {
return 6.0;
}

return 1.0;
}

- (CGFloat)tableView:(UITableView*)tableView
heightForFooterInSection:(NSInteger)section {
return 5.0;
}

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

- (UIView*)tableView:(UITableView*)tableView
viewForFooterInSection:(NSInteger)section {
return [[UIView alloc] initWithFrame:CGRectZero];
}

Change the values accordingly. To remove the space, I think 0.0 will not be accepted. The smallest sane value seems to be 1.0.

UITableView tableHeaderView's missing separator

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..



Related Topics



Leave a reply



Submit