viewcontroller 中的表格视图将宽度扩展到 ipad(或更大的屏幕设备)
tableview in viewcontroller expand width to ipad (or larger screen device)
我在 viewcontroller 中有一个表视图。对于 iphone6 模拟器,它看起来不错,但是当我在 iPad Air 或更大屏幕的设备上查看它时,tableview 的宽度不会扩展。以下是它的外观:
有没有动态的方法可以配置tableview来扩展宽度?
以编程方式设置它,以便它在初始调用期间和在 viewWillAppear 中加载:
let screenSize = UIScreen.main.bounds
let screenWidth = screenSize.width
let screenHeight = screenSize.height
tableView.frame.size.width = screenWidth
tableView.frame.size.height = screenHeight
我在 viewcontroller 中有一个表视图。对于 iphone6 模拟器,它看起来不错,但是当我在 iPad Air 或更大屏幕的设备上查看它时,tableview 的宽度不会扩展。以下是它的外观:
有没有动态的方法可以配置tableview来扩展宽度?
以编程方式设置它,以便它在初始调用期间和在 viewWillAppear 中加载:
let screenSize = UIScreen.main.bounds
let screenWidth = screenSize.width
let screenHeight = screenSize.height
tableView.frame.size.width = screenWidth
tableView.frame.size.height = screenHeight