How to increase the UITableView separator height?

后端 未结 17 2203
花落未央
花落未央 2020-12-08 00:19

I want more space(10px) between each cell. How can I do this?

And I have added this code

tableView.separatorStyle = UITableViewCellSepar         


        
17条回答
  •  鱼传尺愫
    2020-12-08 00:55

    You can do this entirely in the storyboard. Here is how:

    • go to the storyboard and select the tableview
    • Show the Size Inspector and from there set row height to say 140.
    • then show the Attributes Inspector and from there set your separator to Single Line and Style Plain and choose a color
    • then in the storyboard (or in Document Outline) select the cell
    • and again in the Size Inspector, under the Table View Cell, set custom Row Height to say 120.

    That’s all. Your separator will be 20 units tall.

提交回复
热议问题