I try to add separator line like this.
But separator line disappearing when there is no data.
Can anyone please help me solve this issue?Thanks.
I try to add separator line like this.
But separator line disappearing when there is no data.
Can anyone please help me solve this issue?Thanks.
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.
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
}
In you viewDidLoad
function add this:
yourTableViewReference.fillerRowHeight = UITableViewCellSeparatorStyleSingleLine