UITableViewCell Separator disappearing in iOS7
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
This old iOS 7 issue was usually not a mysterious rendering bug. It was mostly a separator inset issue introduced by the newer layout style. Cells still had separators, but the insets and margins made them appear missing or shifted in ways older table view code did not expect.
What Changed in iOS 7
Before iOS 7, developers often relied on the default separator behavior without touching insets. iOS 7 introduced new visual defaults, and table view separators became more sensitive to:
- '
separatorInset' - layout margins
- cell content width assumptions
So code that looked fine on older versions could suddenly appear to have no separator at all.
The Usual Fix: Zero the Insets
The common fix was to set separator insets to zero.
Objective-C example:
And often at the cell level too:
This made the separator span the expected width again.
Layout Margins Also Matter
Later iOS behavior introduced layoutMargins, so fixing only separatorInset was not always enough. If the cell or table view still had nonzero margins, the separator could remain visually offset.
A more complete compatibility approach looked like this:
This became the stronger fix once layout margins entered the picture.
Check the Table Width and Style
Sometimes the separator was not fully gone. It was simply not where the developer expected because:
- the table had grouped style rather than plain style
- the cell width was changing
- custom content or background views obscured the line
So if zeroing insets does not help, inspect:
- table view style
- custom cell background views
- whether the separator color matches the background too closely
The visual result can look like a missing separator even when the real issue is contrast or layout.
Modern Perspective
This issue is historically tied to iOS 7-era table layouts, but the underlying lesson still matters: default UI metrics can change across system versions, and code that assumes exact default separator behavior is fragile.
If the UI depends heavily on exact separators, consider whether a custom separator view would be more predictable than relying on defaults. That gives you full control over width, color, and margins instead of inheriting platform behavior that may shift between OS releases.
That is not always necessary, but it is often the better choice for highly customized table view designs.
Common Pitfalls
- Assuming the separator is gone when it is actually offset by inset or margin settings.
- Fixing only
separatorInsetand ignoringlayoutMargins. - Forgetting that grouped tables and custom backgrounds affect visual expectations.
- Relying on default table appearance while also heavily customizing cells.
- Treating the issue as random rendering behavior instead of a layout configuration issue.
Summary
- The disappearing separator issue in iOS 7 was usually caused by inset and margin behavior.
- Setting
separatorInsetto zero was the classic first fix. - In many cases,
layoutMarginsandpreservesSuperviewLayoutMarginsalso needed adjustment. - Table style, backgrounds, and contrast can make a separator appear missing even when it exists.
- The broader lesson is to avoid depending too heavily on fragile default UI metrics.
Related reading
- UITableViewCell, show delete button on swipe
- UITableViewCell show white background and cannot be modified on iOS7
- UITableViewCell subview disappears when cell is selected
- UITableViewCell with UITextView height in iOS 7?
- UITableViewHeaderFooterView Unable to change background color
- UITapGestureRecognizer - make it work on touch down, not touch up?
- UITapGestureRecognizer - single tap and double tap
- UITapGestureRecognizer breaks UITableView didSelectRowAtIndexPath
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.