MDCBottomSheetController软键盘,避免按下“向上查看”

问题描述 投票:1回答:1

我正在使用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

enter image description here

ios swift bottom-sheet ios-keyboard-extension material-components-ios
1个回答
-1
投票

建议的解决方案

增加文本字段顶部约束的常数。

理由

尝试和错误。

© www.soinside.com 2019 - 2024. All rights reserved.