0

hello I want to show a custom separator line with the same color and height of like default table separator. I am using Dynamic Prototype Table. I have put UIView from interface builder to my cell and set its height to 1px and setup an outlet

@IBOutlet weak var separatorLineUIView: UIView!

then I don't know what should I write here in cellForRowAtIndexPath function

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

       let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! ProductRequestTableViewCell
           cell.separatorLineUIView

and also want to set its color and height to default table separator line so that it shows same for all the devices

Cœur
  • 37,241
  • 25
  • 195
  • 267
hellosheikh
  • 2,929
  • 8
  • 49
  • 115

1 Answers1

0

The easiest way is to set its height as 0.5, not 1 in interface builder.

Because views' size is measured in points, and currently we have 2 pixels per point for retina screens and 3 pixels (which is downsampled) per point for retina HD screens.

And if you want to do it better, you can set separator's height to be equal to 1.0 / UIScreen.mainScreen().scale

Anton Tyutin
  • 626
  • 1
  • 5
  • 15