UIScrollView behavior is different in iOS8

2019-04-29 14:02发布

问题:

I have the following layout

So it's basically a scroll view that occupies whole screen. Content size is set to triple-width and same height. Inside the scroll view - there is container view and three table views - one per page. Only middle table view is visible initially.

This allows me to use scroll view horizontal scrolling to navigate between the tables and vertical scrolling inside the middle table.

I know that Apple doesn't really recommend putting UITableView inside UIScrollView, but in this particular case I don't know how to implement it differently, and until iOS8 everything was working fine.

UIScrollView would not recognize any vertical scrolling (since content height was equal to scroll view height) and these gestures were passed directly to UITableView.

But starting in iOS8 - this getting broken. UIScrollView would allow some vertical scrolling and basically intercept scrolling gestures sent to UITableView.

I created a simple project that works fine in iOS7 but is broken in iOS8. Anybody has any idea how to fix this problem?

Link to the project: https://dl.dropboxusercontent.com/u/6402890/TablePaging.zip

回答1:

I haven't been able to solve this and as I mentioned in comments had to re-write logic using built-in UIPageViewController class.



回答2:

If I change the Class of your ScrollView in Interface Builder to UIScrollView, it fixes part of the problem. Now just the UITableView goes up and down, and I go left-and-right, but haven't gotten rid of the space at the top.