hachinoBlog

hachinobuのエンジニアライフ

UITableViewCellが無い領域のUITableViewのSeparatorを消す方法

背景

TableViewCellが表示されている領域にはSeparatorあって良いんだけど、Cellが1個しかなくて後はUITableViewの領域で、その領域ではSeparatorを表示したくなかった

解決

TableViewのTableFooterViewに何か突っ込めばUITableView領域にSeparatorは出ない

tableView.tableFooterView = UIView(frame: CGRectZero)