I am downloading the x number of images from server and show in collection view. Now I want to enabled the paging . There are lot of tutorials on that but I am new in iOS that's why I don't know how to scroll x number of images. Here is the images of what I want
May be this will help someone.
CGRect screen = [[UIScreen mainScreen] bounds];
CGFloat width = CGRectGetWidth(screen);
CGFloat height = CGRectGetHeight(screen);
CGSize mxSize = CGSizeMake( [imgesArry count]*width , height-114);
[scrlView setContentSize : mxSize];
self.customView.translatesAutoresizingMaskIntoConstraints =YES;
self.customView.frame = CGRectMake(0, 0, mxSize.width, mxSize.height);
int incX = 0 ;
for( int i = 0; i < [imgesArry count]; i++)
{
UIImageView *imagView = [[UIImageView alloc]initWithFrame : CGRectMake(incX,0,width ,height-114)];
imagView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",[imgesArry objectAtIndex:i]]];
[self.customView addSubview:imagView];
incX+= width;
}
[scrlView setContentOffset:CGPointMake(0, 0)];
Get the Screen size of the screen and multiple with the array count so that we get the max width we needed and than using a for loop we add the same name of imageview we need.