DRPaginatedScrollView 0.1

DRPaginatedScrollView 0.1

LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Dec 2014

Maintained by Unclaimed.

  • By
  • David Román

Implement a paginated scroll view really easily using blocks.

DRPaginatedScrollView GIF


  • Block-driven pages setup.
  • Jump between pages (with bouncy effect).
  • Automatic jump to the next page by tapping.
  • Autolayout-ready.
  • It supports both portrait and landscape orientations.

DRPaginatedScrollView GIF

How to use

Getting page-related information

- (NSInteger)currentPage
  • Returns: index of the current page displaying (indexes start from 0).
- (NSInteger)nextPage
  • Returns: index of the next page (indexes start from 0).
- (NSInteger)lastPage
  • Returns: index of the last page (indexes start from 0).
- (NSInteger)numberOfPages
  • Returns: the current number of pages of the paginated scroll view.

Setting up pages

- (void)addPageWithHandler:(void (^)(UIView * pageView))handler
  • handler is a block passing the view that will contain the subviews for the new page, so in that block you just need to add all the views to be displayed on that page to the pageView. It'll just work.

Applying autolayout on the subviews is not obligatory, but recommended.

Anyway, if you decide to use autolayout I suggest using a framework called Masonry. Pretty great stuff.

Here's an example without using autolayout, to simplify things. If you want to see an example of this implementation using autolayout, check out the demo app:

[paginatedScrollView addPageWithHandler:^(UIView * pageView) {
    UIView * square = [UIView new];
    [square setBackgroundColor:[UIColor redColor]];
    [square setFrame:CGRectMake(0, 0, 100, 100)];

    [pageView addSubview:square];

Jumping between pages

- (void)jumpToPage:(NSInteger)page bounce:(CGFloat)bounce completion:(void (^)(void))completion
  • page specifies the index of the page to jump.
  • bounce specifies the amount of bouncy effect the jump will be performed with. Recommended values are 0-40, being 0 the total absence of bounce.
  • completion is a block that will be executed after the jump is performed.

Here are some examples:

// Jumping to the 4th page with no bounce effect and completion

[paginatedScrollView jumpToPage:3 bounce:0 completion:^{
    NSLog(@"Jump finished!");

// Jumping to the first page with a normal bounce effect and no completion

[paginatedScrollView jumpToPage:0 bounce:20 completion:nil];

// Jumping to the next page with a little bounce effect and no completion

[paginatedScrollView jumpToPage:[paginatedScrollView nextPage] bounce:10 completion:nil];

// Jumping to the last page with a high bounce effect and no completion

[paginatedScrollView jumpToPage:[paginatedScrollView lastPage] bounce:40 completion:nil];

Controlling details of jumps between pages

BOOL isJumping
  • Description: whether the paginated scroll view is currently jumping between pages or not.
NSTimeInterval jumpDurationPerPage
  • Description: the duration each page will last jumping with when jumping through multiple pages.
  • Default value: 0.1
  • Recommended value: 0.05-0.175

Handling taps on the view

void (^actionWhenTappedBlock)(DRPaginatedScrollView *)
  • Description: action that executes when the paginated scroll view is tapped.
  • Default value:

    ^(DRPaginatedScrollView * paginatedScrollView) {
        [paginatedScrollView jumpToPage:[paginatedScrollView nextPage] bounce:0 completion:nil];
  • Recommended value: any.

Wish list

  • CocoaPods support.
  • Automatic block-customizable page indicator (paginatedScrollView configurePageIndicatorWithHandler:).
  • Being able to clip any subview until a determined page (pageView clipSubview:untilPage:) and forever (pageView clipSubviewForever:).


  • iOS 6 or higher.
  • Automatic Reference Counting (ARC).



David Román | @Dromaguirre


No contributors, yet.


You can use it for whatever you want, however you want. I just would love to know if you're using it in any project of yours.