Reputation: 2649
I'm attempting to display a static tableview in my UITableViewController
as I only want to display 1 row. I've set the tableview's content
to Static Cells
already but I still get more rows than I want to appear when I deploy it to my test device. I've also explicitly set the number of rows and sections in my UITableViewController
subclass but still the results are the same.
I've attached some screenshots to further explain the result I'm getting.
Here's a screenshot of what my tableview controller looks like in the storyboard
Here's a screenshot of the attribute inspector of my table view
Here's a screenshot of my UITableViewController
subclass
Finally, here's a screenshot of what the tableview looks like on the test device
As you can see even though I set the number of static rows to 1, I still get multiple rows. I'm not sure why this is happening but if anyone has any ideas, I'd appreciate the help.
Thanks
Upvotes: 2
Views: 298
Reputation: 27550
An alternative to .grouped
style, if you have to use .plain
, is to attach a zero height tableFooterView
to the table view since it won't draw separators below a footer.
You can either drag a view into the table view in Interface Builder, or add it in your viewDidLoad:
override func viewDidLoad() {
super.viewDidLoad()
tableView.tableFooterView = UIView()
}
Upvotes: 0
Reputation: 9777
Change the table view's style to Grouped
.
This should give the effect you desire:
Upvotes: 3