ios - Why is UIKeyboardWillShowNotification called every time another TextField is selected? -
i have project contains uiscrollview
, many uitextfield
inside it.
for first time select uitextfield
, uikeyboardwillshownotification
called, fine. whenever select new uitextfield
(the keyboard still there), uikeyboardwillshownotification
called again !!!, weird.
i set symbolic breakpoint [uiresponder resignfirstresponder]
, see hit before , after uikeyboardwillshownotification
called !!!
the other thing uikeyboardwillhidenotification
called when hit "done" button on keyboard
i'm sure not call resignfirstresponder
, becomefirstresponder
, endediting
anywhere. (i mean not call wrongly)
what can cause problem ?
here stacktrace
the problem set inputaccessoryview
uitextfield
, , cause uikeyboardwillshownotification
being called again when new uitextfield
selected
this article working keyboard on ios explains well
additional changes take place when connect external keyboard ipad. in particular case, notification behavior depends on inputaccessoryview property of control reason displaying keyboard.
if inputaccessoryview not present or height equal 0 points, no keyboard notifications sent. guess because in case, no visual changes take place in application. otherwise, notifications behave expected – means being sent in majority of cases when keyboard displayed or hidden in normal (not undocked or split) state.
whenever new uitextfield
selected, os needs compute frame keyboard again, , following notifications posted
uikeyboardwillchangeframenotification uikeyboardwillshownotification uikeyboarddidchangeframenotification uikeyboarddidshownotification
the same applies when textfield loses first responder status
note using same view inputaccessoryview
cause uikeyboardwillshownotification
called once
Comments
Post a Comment