0
我想基於某些設置更改我的Modal的preferredContentSize。動態更改preferredContentSize?
例如:有一個開關,如果開關關閉,我想隱藏一些單元格。這很好,但我也想調整模式。
var contentSize = CGSizeMake(560, 562)
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.preferredContentSize = contentSize
}
@IBAction func photoSwitchPressed(sender: UISwitch) {
if sender.on == true {
photos = true
} else {
photos = false
contentSize = CGSizeMake(560, 462) // resize?
self.viewWillAppear(true) // how to force resize?
}
tableView.reloadData()
}
任何想法:
不適與正常調整呢?提前致謝。