「Swift」UITableViewのセルの区切り線の色を設定する
書式
tableView.separatorColor = .色
tableViewのseparatorColorプロパティに色を指定して区切り線の色を変更します。
使用例
class ViewController: UIViewController, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
tableView.dataSource = self
//線を青くする
tableView.separatorColor = .blue
}
}
実行結果
UITableViewの区切線が青くなります。