1

I attempted to use UITableView (with static content) to create a setting screen similar to the iPhone's system setting screen. It mostly works excepts the blank space under the last row are filled with white row cells instead of background color, as shown in this screenshot:

enter image description here

I have tried various ways to fix this: setting the table view's background, add an empty row as the last row with the background color. What should be the right fix?

teddy
  • 2,158
  • 4
  • 26
  • 34
  • Do you not want to use `UITableView(style: .Grouped)` or `[[UITableView alloc] initWithStyle: UITableViewStyleGrouped]` ? That's what the settings menu uses – rolling_codes Jul 23 '16 at 22:53
  • This is actually a better answer for what I want (setting screen.) Not sure why you deleted the answer. I would up vote and mark it as the acceptable answer if you put it back. Thanks! – teddy Jul 23 '16 at 23:58
  • I did that! I was not sure if you were looking for that kind of solution. Glad it helps – rolling_codes Jul 24 '16 at 00:01

3 Answers3

2

You need:

tableView.tableFooterView = UIView()

How to remove empty cells in UITableView?

Eliminate extra separators below UITableView

Community
  • 1
  • 1
Vlad
  • 245
  • 1
  • 10
2

Objective-C

[[UITableView alloc] initWithStyle: UITableViewStyleGrouped]

Swift 2

UITableView(style: .Grouped)

Swift 3

UITableView(style: .grouped)

You should also be able to set the table view style in the interface builder.

rolling_codes
  • 15,174
  • 22
  • 76
  • 112
0

Go to View Section of the TableView's Attributes Inspector and set the background color there. It will work

Shahriar Nasim Nafi
  • 1,160
  • 15
  • 19