ios - zoomScaled UIScrollView positioning incorrectly when field tapped -


i have strange issue uiscrollview when it's zoomed in.

we display user-created forms on ipad within uiscrollview, fields can of varying size. positioning seems handle enough moving fields (by adding content offsets when keyboard appears) act of tapping field appears doing kind of positioning.

my problem - if user zoomed in point field wider view, tapping field (even if keyboard visible) scrolls view way right, despite being left-to-right text entry no text in field yet. pushes left of field (where user expecting type) off left of screen.

note - mentioned above, happens if keyboard visible , user editing field. tapping field again (to display delete / copy / paste etc) shoves scroll view on right, cutting off first part of field.

the ideal solution have instead scroll make caret position visible on screen, can't find related issue or evidence else has seen on or google.

example - example position

you can locate problem adding symbolic breakpoint:

[uiscrollview setcontentoffset:animated:]

enter image description here

enter image description here

run app again , enable breakpoint before bug happens.

and when trigger break point, can see thread trace this:

enter image description here

so problem when uitextfield calls becomefirstresponder, call [uiscrollview scrollrecttovisible:animated:] textfield's frame rect in scrollview,if it's contained in uiscrollview.

and if call [uiscrollview scrollrecttovisible:animated:] textfield's frame rect in scrollview manully, can recreate bug.

to fix issue, can subclass uiscrollview,and change behaviour of [uiscrollview scrollrecttovisible:animated:] show left side of rect, or don't scroll if rect equal 1 of subclass (also uitextfield)'s frame.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -