Let’s imagine you have setup your UITableView and populated its cells. Things are looking good but there are empty cells after your content has finished? Well, there is an easy way to hide those empty cells. Simply enter the following into ViewDidLoad() if you are using a UITableViewController or if your creating a UITableView then […]
UITableView
UITableView willDisplayHeaderView
To amend the header section display in terms of colours for example on a uitableview you can utilise the UITableView Delegate protocol of tableView:willDisplayHeaderView:forSection: You can alter the background colour using the view tintColor and then by accessing the view you can amend the header text label.
1 2 3 4 5 6 7 8 |
override func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) { view.tintColor = UIColor.redColor() let headerView: UITableViewHeaderFooterView = view as! UITableViewHeaderFooterView headerView.textLabel.textColor = UIColor.whiteColor() } |
You can apply different styles for different section headers using the […]