我正在使用MDCBottomSheetController
以下是我的代码以显示底层控制器
let bottomSheet: MDCBottomSheetController = MDCBottomSheetController(contentViewController: viewController)
// Present the bottom sheet
bottomSheet.shouldFlashScrollIndicatorsOnAppearance = true;
if openFor == SearchBottomSheetViewController.OPEN_FOR_DATE {
bottomSheet.preferredContentSize = CGSize(width: self.view.frame.size.width, height: self.view.frame.size.height * 0.3)
}else {
bottomSheet.preferredContentSize = CGSize(width: self.view.frame.size.width, height: 3 * self.view.frame.size.height / 4)
}
// bottomSheet.dismiss(animated: <#T##Bool#>, completion: <#T##(() -> Void)?##(() -> Void)?##() -> Void#>)
present(bottomSheet, animated: true, completion: nil)
当显示软键盘时,底部ui被向上推,但我不希望在显示键盘时被向上推UI
请参阅下面的问题gif
建议的解决方案
增加文本字段顶部约束的常数。
理由
尝试和错误。