Im trying to detect which size of the phone the user got and set the scrollview length to appropriate size. For example if the user is using an iPhone plus the scroll length should be shorter then if the user is using an iPhone 5
- (void)scrollViewDidScroll:(UIScrollView *)sender {
if (!pageControlBeingUsed) {
// Switch the indicator when more than 50% of the previous/next page is visible
CGFloat pageWidth = self.scroll2.frame.size.width;
int page = floor((self.scroll2.contentOffset.x - pageWidth / 3) / pageWidth) + 1;
self.pageControl.currentPage = page;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
if ([[UIScreen mainScreen] scale] == 2.0) {
if([UIScreen mainScreen].bounds.size.height == 667.0){
self.scroll2.contentSize = CGSizeMake(300, 100);
// iPhone retina-4.7 inch(iPhone 6)
}
else if([UIScreen mainScreen].bounds.size.height == 568.0){
self.scroll2.contentSize = CGSizeMake(300, 5500);
// iPhone retina-4 inch(iPhone 5 or 5s)
}
else{
// iPhone retina-5 inch inch(iPhone Plus)
}
}
}