UIScrollView

extension UIScrollView
  • Enables form functionality (content avoids keyboard, sets interactive dismiss mode). This calls registerKeyboardNotifications and sets keyboardDismissMode to be interactive.

    Declaration

    Swift

    public func setUpFormFunctionality()
  • Registers the scrollview to receive keyboard notifications. These notifications will automatically be handled in keyboardWillShow(:) and keyboardWillHide(:).

    Declaration

    Swift

    public func registerKeyboardNotifications()
  • Called when the keyboard will show or change its frame. Adjusts contentInset and scrollIndicatorInsets to avoid the keyboard frame.

    Override to implement additional behavior.

    Declaration

    Swift

    @objc
    open func keyboardWillShow(height: CGFloat, duration: TimeInterval, options: UIView.AnimationOptions)

    Parameters

    height

    keyboard height

    duration

    keyboard animation duration

    options

    keyboard animation options

  • Called when the keyboard will hide. Adjusts contentInset and scrollIndicatorInsets back to .zero.

    Override to implement additional behavior.

    Declaration

    Swift

    @objc
    open func keyboardWillHide(duration: TimeInterval, options: UIView.AnimationOptions)

    Parameters

    duration

    keyboard animation duration

    options

    keyboard animation options