I made a custom UITableViewCell in IB, but for some reason, despite the single line option for separator being selected, there are no separator lines on my table.
Has this happened to any of you before? What gives?
Thanks!
I made a custom UITableViewCell in IB, but for some reason, despite the single line option for separator being selected, there are no separator lines on my table.
Has this happened to any of you before? What gives?
Thanks!
For anyone seeing this: My issue was that I had multiple sections, and the first cell in each section didn't have a separator. In my table view, I had overwritten the heightForHeader function (returning 0). Deleting this fixed the issue.
I found
separatorStyle
in UITableView class reference. It says it will add separatorStyle to the cell returned by the delegate method, tableView:cellForRowAtIndex:.So, I think you should modify the style property on the UITableView instance.
Is the UITableViewCell in IB associated with a UITableViewCell subclass that overrides
drawRect:
? If so, make sure you are calling the super implementation, as that's what draws the line at the bottom. If you are overridinglayoutSubviews
make sure no views are obscuring the bottom of the cell.In my case, i forgot to call [super layoutSubviews] after overriding the layoutSubviews method. Took me two hours to find the problem.
in my case I have to set the separatorStyle property of the tableView
tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
Maybe an unlikely case, but there's another possible cause.
I have a custom
UITableView
called AddressBookTableView and it is included in a .XIB for one of my view controllers. The thing I noticed was that it had been added as aUIView
element with custom class specified to be AddressBookTableView. I deleted this element and added aUITableView
element instead whose class I again specified to be AddressBookTableView and the separators magically reappeared!Took me a super long time to find this...
Make sure your custom
UITableView
.XIB elements are indeed customUITableView
elements NOT renamedUIView
elements.To be honest I'm surprised that the only noticeable artifact of this mistake was that the separators were missing. Other than that the UITableView still functioned normally?