1

I am using MDCBottomSheetController

following is my code to present bottom sheet controller

 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)

When ever soft key board is shown bottom sheet ui is pushed up I don't want UI to be pushed up when keyboard is shown

Refer to below gif for issue

enter image description here

Jerry Okafor
  • 3,710
  • 3
  • 17
  • 26
amodkanthe
  • 4,345
  • 6
  • 36
  • 77
  • I am having the same issue, please peer review my edit, I have added the material-component-ios tag so that the guys there can find it and possibly provide an answer. – Jerry Okafor Jun 19 '19 at 19:46
  • approved reported issue on github as well please add comment there as well here is link https://github.com/material-components/material-components-ios-codelabs/issues/44 – amodkanthe Jun 19 '19 at 19:50

2 Answers2

0

To achieve that successfully, use the code below. (Just add the removeKeyboardObserver() function in your viewDidLoad().)

func removeKeyboardObserver() {
    NotificationCenter.default.removeObserver(MDCKeyboardWatcher.shared()!)
}

func textViewDidEndEditing() {
    MDCKeyboardWatcher.load()
}
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
kelvinoff
  • 46
  • 4
-1

Suggested Solution

Increase the constant of text field's top constraint.

Reasoning

Trial and error.

George
  • 3,384
  • 5
  • 40
  • 64