Search code examples
iosobjective-cipaduiscrollviewuser-interaction

Error: User interaction disabled in lower parts of UIScrollView


I've got a document viewer that has one UIView (page) as a subview of a 'scrolledView' (UIView) of a UIScrollView. The page has more subviews, UIButtons and UITextFields for example.

The user can manually pan and zoom in the scroll view, but for some features, I'm doing a programmatic scrolling/panning to bring the text fields or buttons into view.

In some cases I need to programmatically adjust the contentSize for the scroll view and the frame of the scrolled view (to make sure text fields at the bottom of the page can be moved above the keyboard).

Also (I think) I'm correctly scaling the coordinates for contentSize and the frame of the scrolled view by the zoomScale of the scroll view.

Usually everything works as it should.

This is the problem:

In some rare occasions, after I've triggered the zooming out by clicking 'Next' on the keyboard, the buttons and text fields in the lower part of the page don't react to my touch any more. (It's usually around the lowest 10% or so.) Those above do like they should.

Can anybody give me any hints what to look for?

I have seen this on iOS 7 and iOS 8, older versions I don't know.


Solution

  • It seems some problems where caused by readjusting the contentSize and frame of the scrolled view inside - (void)scrollViewDidZoom:(UIScrollView *)scrollView Then other parts modified the same properties, for example in completion blocks of animations and it is possible that the values ended up wrong.

    (I was using a trick to keep the content centered when the user had zoomed out. Now I'm instead getting the same effect by using the contentInsetproperty)