How to resize UITableView in UITableViewController with section header

后端 未结 5 1134
情话喂你
情话喂你 2020-12-29 13:14

I\'ve got a grouped UITableView in a UITableViewController and I want to resize it horizontally.

I tried many different ways but none of them was perfect.

5条回答
  •  滥情空心
    2020-12-29 13:44

    The main issue is that the table view of a UITableViewController is the main view so it's not meant to be resized.

    The best option is not to use UITableViewController. Instead, use UIViewController and add your own UITableView as a subview of the view controller's main view. This way you can size as needed.

    Of course there is extra work to hook up all of the plumbing so your view controller works like a table view controller but there isn't too much to do.

提交回复
热议问题