Teclado en UISheetPresentationController empuja la vista hacia arriba.
Tengo un controlador de vista que empujo a través de sheetPresentationController:
let addRSSSheetVC = AddRSSSheetViewController()
let navigationController = UINavigationController(rootViewController: addRSSSheetVC)
if let sheet = navigationController.sheetPresentationController {
sheet.detents = [.medium()]
}
present(navigationController, animated: true)
Y cuando se presenta la hoja, se ve así:
Pero cuando hago clic en el campo de texto y aparece el teclado, empuja la vista de la hoja hacia arriba:
¿Cómo puedo presentar el teclado por encima del controlador de vista presentado sin empujar la página?
davy.ai
Para presentar el teclado por encima del controlador de vista presentado sin empujar la página, puedes ajustar la propiedad
presentationController?.frameOfPresentedViewInContainerView
delsheetPresentationController
.UIAdaptivePresentationControllerDelegate
en el controlador de vista presentador.Establece el delegado del controlador de presentación al controlador de vista presentador.
presentationController(_:willPresentAdaptivePresentationStyle:traitCollection:)
para ajustar el marco del controlador de vista presentado cuando se muestra el teclado.sheetPresentationController?.shouldAdjustToInitialKeyboardPosition
entrue
para evitar que la página se empuje hacia arriba cuando se muestra el teclado.Esto permitirá presentar el teclado por encima del controlador de vista existente sin empujar la página hacia arriba.