TPKeyboardAvoiding icon indicating copy to clipboard operation
TPKeyboardAvoiding copied to clipboard

Issue in the algorithm implementation to find next responder

Open fodlife opened this issue 11 years ago • 1 comments

I have found the bug in implementation of the algorithm to find next responder.

Function : TPKeyboardAvoiding_findTextFieldAfterTextField Part : the condition expression if the found textfield (or textview) is the exact "Next" field of the priortextfield.

childView != priorTextField && CGRectGetMinY(frame) >= priorFieldOffset && CGRectGetMinY(frame) < *minY && !(frame.origin.y == priorTextField.frame.origin.y && frame.origin.x < priorTextField.frame.origin.x)

This should be done like this (the frames should be relative values based on the superview)

childView != priorTextField && CGRectGetMinY(frame) >= priorFieldOffset && CGRectGetMinY(frame) < *minY && !(CGRectGetMinY(frame) == priorFieldOffset && CGRectGetMinX(frame) < priorFieldOffsetX)

Here, priorFieldOffsetX = CGRectGetMinX([self convertRect:priorTextField.frame fromView:priorTextField.superview])

Because of this issue, TPKeyboardAvoidingTableView is sometimes not finding the correct next textfield inside the dynamically added tableviewcell if the cell has 2 textfields that have the same y value.

fodlife avatar Sep 13 '14 03:09 fodlife

I believe I've fixed this with #175. Would you mind trying out my fork with that pull request implemented and let me know if this solves your problem?

AnthonyMDev avatar Jul 23 '15 03:07 AnthonyMDev