UITableViewCell in ios7 now has gaps on left and right

skeg0 picture skeg0 · Sep 24, 2013 · Viewed 19.8k times · Source

I have a UITableView where, in ios6, my custom cell stretched completely to the left and right sides of the screen. So my square image on the left of the cell was hard up against the phone screen.

However, now in ios7, there is a small gap appearing on the left hand side so the image is now away from the side and slightly overlaps my text within the cell.

This also seems to be happening in other apps I have that I am now viewing in ios7 - all have a gap on the left and perhaps the right as well.

My Custom cell is set to a size of 320 according to Interface Builder - ios 7 hasnt changed this has it?

Answer

loydbrahn picture loydbrahn · Sep 27, 2013

iOS7 added a separatorInset property.

Try adding this to your UITableViewController:

if ([self.tableView respondsToSelector:@selector(separatorInset)]) {
    [self.tableView setSeparatorInset:UIEdgeInsetsZero];
}