我有一个带有地图的主视图控制器。我有另一个控制器作为弹出窗口呈现。
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
if segue.identifier == "weatherDetail" {
let dest = segue.destination as! WeatherDetailController
dest.json = json
let screenSize: CGSize = UIScreen.main.bounds.size
dest.preferredContentSize = CGSize(width: screenSize.width - 50, height: /*screenSize.height - 200*/ 153)
let popoverController = dest.popoverPresentationController
if popoverController != nil {
popoverController?.delegate = self
popoverController?.permittedArrowDirections = .init(rawValue: 0)
popoverController?.sourceView = view
popoverController?.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.size.height - (dest.preferredContentSize.height / 2) - 20, width: 0, height: 0)
}
}
}
func adaptivePresentationStyle(for controller:UIPresentationController) -> UIModalPresentationStyle {
return .none
}
以下是当前代码的作用(仅提供一个想法):
我想知道如果不是出现了弹出窗口,我可以让它从底部滑入吗? (我可能没有正确使用popovers,它似乎对我正在做的事情有效。)