I have an app that contains a UIScrollView with 3 pages. It will swap pages when a over scrolls 50% over to the next element, and each page is an own UIViewController(And each of them contains UILabels and UITextFields). Each page has a width set equals the width of the current device.
This works perfectly on iOS 8, but the scrollview is 33% too small on iOS 7, and each view.frame.orgin.x is 33% too small, so the views overlaps. The width of each of the pages is, however, correct.
My question is, why is this offset by 33%? Why does this work perfectly on iOS 8, but not on iOS 7?
Original code for scrollview:
scrollview.contentSize = CGSizeMake((screenRect.size.width * 3), scrollview.frame.size.height);
Scrollview code that actually work:
CGRect screenRect = [[UIScreen mainScreen] bounds];
if([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0)
{
scrollview.contentSize = CGSizeMake((screenRect.size.width * 3) * 1.334, scrollview.frame.size.height);
}
else
{
scrollview.contentSize = CGSizeMake((screenRect.size.width * 3), scrollview.frame.size.height);
}
Relevant code for each of the pages:
CGRect frame = [[UIScreen mainScreen] bounds];
if([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0)
{
frame.origin.x = (frame.size.width * page) * 1.334;
}
else
{
frame.origin.x = (frame.size.width * page);
}
frame.orgin.y = 0;