get keyboard height swift
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardWillShow),
name: UIResponder.keyboardWillShowNotification,
object: nil
)
@objc func keyboardWillShow(_ notification: Notification) {
if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue {
let keyboardRectangle = keyboardFrame.cgRectValue
let keyboardHeight = keyboardRectangle.height
}
}@objc func keyboardWillShow(_ notification: Notification) {
if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue {
let keyboardRectangle = keyboardFrame.cgRectValue
let keyboardHeight = keyboardRectangle.height
}
}
Also in Swift:
- screen recorder swift
- xcode execute function from a different file
- swift play video from url
- swift change background color
- how to unwrap arrays with optional value in swift
- how to get appdelegate object in swift
- swift get slected row data in tableview cell
- swift
- swift wait 5 seconds
- swift append to start of string
- swipe right to delete swiftui
- Blinking effect on UILabel
- setting a local notification at specific time every day swift
- show back button in navbar swift
- custom binding swiftui
- Close iOS Keyboard by touching anywhere using Swift
- swift string keep only numbers
- alertdialog flutter
- swiftui foreach
- how to put background image in swiftui
- remove back button from navigation bar swift
- how to find circle point in line chart swift 4 site:stackoverflow.com
- if statement swfit
- register for remote notifications swift