UIScrollView
extension UIScrollView
-
Enables form functionality (content avoids keyboard, sets interactive dismiss mode). This calls
registerKeyboardNotifications
and setskeyboardDismissMode
to beinteractive
.Declaration
Swift
public func setUpFormFunctionality()
-
Registers the scrollview to receive keyboard notifications. These notifications will automatically be handled in
keyboardWillShow(:)
andkeyboardWillHide(:)
.Declaration
Swift
public func registerKeyboardNotifications()
-
Called when the keyboard will show or change its frame. Adjusts
contentInset
andscrollIndicatorInsets
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
andscrollIndicatorInsets
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