Megan
Megan

Reputation: 45

Remove space at the top of first row in table view

In my application i'm using custom cell in table view to display images in all rows. But in my .xib file there is a big empty space comes at the top of the custom cell. Can anyone tell me that how remove that space in iOS7 (iPad)? (like how to change the Y axis of the custom cell)

Upvotes: 1

Views: 2199

Answers (3)

CWineland
CWineland

Reputation: 615

This is an IOS7 related issue with UITableViewStyleGrouped and size of footer views in section.

If you set the footerView to be size 0 it defaults to a larger value, The solution I found was to set the footer to a very small non zero number

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

Upvotes: 2

amurcia
amurcia

Reputation: 791

This might help you:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

        UILabel *sectionHeader = [[UILabel alloc] initWithFrame:CGRectNull];
        sectionHeader.hidden = YES;
        return sectionHeader;    
}

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

Sometimes the empty space in the first row is the section header space. This functions eliminate it.

Upvotes: 0

Retro
Retro

Reputation: 4005

Try to set into your property inspector like this..

enter image description here

Upvotes: 0

Related Questions