0
votes

At first, I am facing a strange problem with a UIScrollView with Pagin enable but only on iPhone 4 and iOS 7.

So the idea is that I have a UIScrollView (A) containing a UIView (B) that has subviews (Cs)

It's working perfectly on iPhone 5 screen size, for both iOS 7 and 8. It's working perfectly on iPhone 4 with iOS 8.

It's not working properly on iPhone 4 iOS 7.x

After hours of logging, here is the problem :

UIScrollView A frame height : 480 <- EDIT : this was sometimes 480, sometimes 568 UIScrollView A content size : 960 UIView B frame height : 960

The first page is displaying properly.

When scrolling down to the second page, UIScrollView A contentOffset is 392, instead of the expected 480, so that there is not way to see the bottom of the second page, and bottom of the first page is still visible at the top of the second page.

So the question is : How does iOS find the page size ?

Any help will be appreciated !

2

2 Answers

2
votes

The page size is the size of the scroll view. It sounds like the issue is that the height of the content is not defined correctly. If you are using auto layout you need to make sure that the constraints are set up properly. Otherwise you can set the size of the content programmatically.

Either way checking programatically what the content size of the view is should confirm if this is the issue.

When running in Xcode 6 you can examine the views on the screen more carefully using this button:

Button to examine views

found here:

enter image description here

when your code is running and you are on the correct view

0
votes

I finally get it by removing the UIScrollView bottom constraint and replace it with a height constraint, setting it to the superview height at run time.

It seems that the scroll view paging size is just correctly evaluated, but may scrollview was too big for the screen.