defagos / CoconutKit

CoconutKit is a productivity framework for iOS, crafted with love and focusing on ease of use
Other
1.15k stars 111 forks source link

UIScrollView & adjust offset #38

Open Marcaux opened 7 years ago

Marcaux commented 7 years ago

Using scrollRectToVisible:animated: seems to cause some problems to adjust scrollview offset with the keyboard. Could this solution be suitable?

defagos commented 7 years ago

Thanks for your PR that I could test.

The behavior does not match the initial expected behavior. If a field is already in view when entering edit mode, no scrolling should occur. With your implementation, as soon as you tap on a field, it immediately jumps right above the keyboard, which is annoying from a user point of view.

This is also not perfectly consistent, as this offset can be changed afterwards when the user scrolls:

  1. Tap on the first field. The fields jumps at the bottom, just above the keyboard.
  2. Just slightly grab the parent scroll view. The field jumps at another position.

Could you please recall me what your exact issue with -scrollRectToVisible:animated: was?