How to Create Infinite Scroll in iOS Application?

0
Shares
How to Create Infinite Scroll in iOS Application?
4 (80%) 1 vote

How to Create Infinite Scroll in iOS Application?

SKInfiniteScroll for iOS a subclass of UIScrollView through which users can able to scroll their images continuously without doing much.

When contentoffset reaches to end of the offset, it will restart scrolling from beginning without jerk.

Below image shows infinite scroll in an iOS application.

Create Infinite Scroll in iOS

 

Using SKInfiniteScroll in iOS application provides you many advantages like:

  • Support all the four direction
  • Manage animation speed
  • Restart scroll without jerk
  • In-build parallax effect for image view

How to Install?

Step 1: Download SKInfiniteScroll. In that, you will see a folder named as ‘‘SKInfiniteScroll’’. Just drag that folder to your project as shown in below image.

Step 2: Make sure to enable checkmark of “copy item…”.

Usage

First of all, get an array of UIImage that you want to add in the infinite loop.

NSMutableArray *array = [NSMutableArray arrayWithObjects:
[UIImage imageNamed:@"1.jpg"],
[UIImage imageNamed:@"2.jpg"],
[UIImage imageNamed:@"3.jpg"], nil];

Now, call “createAnimateScrollOfImages” class method of SKInfiniteScroll

CGRect scrollRect = CGRectMake(0, 0, 100, 400);
CGSize imageSize = CGSizeMake(100, 100);
[SKInfiniteScroll createAnimateScrollOfImages:array
ofScrollRect:scrollRect
ofImageSize:imageSize
InView:self.view
withDirection:kScrollDirectionBottom];

 

Parameter descriptions:

ScrollRect: its frame of the scroll view.
ImageSize: its defines visible size of each imageview inside scroll view
InView: a view inside which scrollview should visible
withDirection: a direction in which you want to animate images. It supports all the four directions for animation.

Types of animation directions:

  • kScrollDirectionTop
  • kScrollDirectionBottom
  • kScrollDirectionLeft
  • kScrollDirectionRight

If you want to download SKInfiniteScroll class with the complete example, click the following button. You can use it in your next project.

Do you have any iPhone app development idea that you want to execute? Do you still have any query about how to create SKInfiniteScroll in iOS app, comment down below, Our developers will get in touch with you ASAP.

 
0
Shares
 

Have an App Idea?

Get your free consultation now