I've a `UITableView` with 2 sections, the first is to show a `SegmentControl` and the second is to show my data. The section 2 is Ok, but on the secion of SegControl the component not fit on the right height.

StoryBoard

[![enter image description here](https://i.stack.imgur.com/PWvg3.png)](https://i.stack.imgur.com/PWvg3.png)

Result: The empty space appears below `UISegmentedControl` of cell.

[![enter image description here](https://i.stack.imgur.com/IBLMa.png)](https://i.stack.imgur.com/IBLMa.png)

I tried many ways to solve this:

```
   func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
    if indexPath.section == 1 {
        return 100
    }
    return 44.0
}

func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
    return 0.0
}

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    return UIView()
}

func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {

    if section == 0 {
        return nil
    }
    .
    .
    }

```

**EDIT**

I discovered that this blank space is the Footer, but I don't know How hide this.

[![enter image description here](https://i.stack.imgur.com/BRHqB.png)](https://i.stack.imgur.com/BRHqB.png)

```
        func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
        let view = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
        view.backgroundColor = UIColor.red
        return view
   }

```