objective c - How to scroll in a tabelview when keyboards shows up? -
i have scrollview
in there tableviews
. set when keyboard appears, content above keyboard should move, keyboard won't obscure anything. how can scroll above keyboard, when keyboard up?
you can add add observer check keyboard showing or not.
notificationcenter.default.addobserver(self, selector: #selector(viewcontroller.keyboardwillshow(notification:)), name: nsnotification.name.uikeyboardwillshow, object: nil) notificationcenter.default.addobserver(self, selector: #selector(viewcontroller.keyboardwillhide(notification:)), name: nsnotification.name.uikeyboardwillhide, object: nil) func keyboardwillshow(notification: nsnotification) { if let keyboardsize = (notification.userinfo? [uikeyboardframebeginuserinfokey] as? nsvalue)?.cgrectvalue { print("show") } } func keyboardwillhide(notification: nsnotification) { if let keyboardsize = (notification.userinfo?[uikeyboardframebeginuserinfokey] as? nsvalue)?.cgrectvalue { print("hide") } }
and need calculation content show when keyboard appear , set content offset of scrollview.
Comments
Post a Comment