0

I try to add separator line like this.

image1

But separator line disappearing when there is no data.

image2

Can anyone please help me solve this issue?Thanks.

towa x
  • 3
  • 1

3 Answers3

0

towa x! This can be fixed by adding options to Separator. In MainStoryBoard go to the Attributes Inspector/Separator. Change it to Default - separator are shown in any condition: empty or filled.

Maxim
  • 21
  • 1
0

The accepted answer doesn't even compile! According to the Documentation you have to set the fillerRowHeigt to automaticDimensions.

So the way to write is, to add this line of code to your viewDidLoad or to the part where you setup the tableView:

tableView.fillerRowHeight = UITableViewAutomaticDimension

This variable is only available since iOS 15, so to support older versions use:

if #available(iOS 15.0, *) {
   tableView.fillerRowHeight = UITableViewAutomaticDimension
}
Elliot Czigány
  • 188
  • 1
  • 14
-1

In you viewDidLoad function add this:

yourTableViewReference.fillerRowHeight = UITableViewCellSeparatorStyleSingleLine
Victor Lee
  • 2,467
  • 3
  • 19
  • 37