検証環境:
Xcode 11.4
Swift 5.2
UITableView の style がデフォルトの Plain
だけど、Grouped
っぽいデザインにする方法。
- Grouped だとデータがない空行は表示されないが、Plain だと表示される。
これはtableView.tableFooterView
に UIView を作って突っ込むと消える。
tableView.tableFooterView = UIView() // remove empty cells
ただし、tableFooterView を利用する場合は当然この方法はできない。
- Grouped だと背景色がグレーだが、Plain だと白になっている。
これは StoryBoard でのやり方だが、ViewController.view と TableView の Background Color にSystem Group Background Color
を設定する。
以上。