RayChen
RayChen

Reputation: 1468

UITableViewWrapperView has a leading and trailing margin with super view on tvOS

I'm creating a tableview on tvOS. The UITableViewWrapperView is subview of UITableView and there is a leading and trailing padding between them. How can I remove these paddings? Thanks?

Upvotes: 4

Views: 1351

Answers (3)

Solid Line
Solid Line

Reputation: 63

only following is enough

tableView.insetsLayoutMarginsFromSafeArea = false

Upvotes: 0

Jeroen Bakker
Jeroen Bakker

Reputation: 2169

I solved it with the following setup:

tableView.contentInsetAdjustmentBehavior = .never
tableView.insetsContentViewsToSafeArea = false
tableView.insetsLayoutMarginsFromSafeArea = false
tableView.preservesSuperviewLayoutMargins = false

Note, remember the tvOS guidelines recommends at least 90px spacing for left and right, and 60px spacing for top and bottom.

https://developer.apple.com/design/human-interface-guidelines/tvos/visual-design/layout/

Upvotes: 4

Daniel Storm
Daniel Storm

Reputation: 18898

tvOS table views have a lot of weird quirks. I haven't been able to find a clean solution to this for awhile. For now I've been adding negative constraints to the table view cells.

Upvotes: 0

Related Questions