UITableView space between row and sections

后端 未结 5 1315
野的像风
野的像风 2021-01-13 11:39

I want to make a UITableView as close to the iOS settings view as possible:

How do i create the space between different sections? What\'s the best way?

相关标签:
5条回答
  • 2021-01-13 12:17

    First of all the iOS Settings doesn't use the ViewForSection otherwise the Section view would be placed in the top tableView.

    You can return an empty containerView cell for that specific indexPath and stop didSelect in it, but remember to include the empty cells to the array you are using for other cells.

    0 讨论(0)
  • 2021-01-13 12:19

    You just select grouped style in the Interface Builder and it will separate the table per section, similar as is in the screenshot.

    Here is an attachment:

    0 讨论(0)
  • 2021-01-13 12:33

    Just add the footer height in the table as required:

    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
        return 44
    }
    
    0 讨论(0)
  • 2021-01-13 12:35

    Change Style of UITableView to "Grouped"

    0 讨论(0)
  • 2021-01-13 12:36

    try these..

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    {
      return 30; //according to your need..
    }
    

    i hope it helps..

    0 讨论(0)
提交回复
热议问题