NMPaginator 1.0.0

NMPaginator 1.0.0

LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Dec 2014

Maintained by Nicolas Mondollot.

  • By
  • Nicolas Mondollot

NMPaginator is a simple Objective-C class that handles pagination for you. It makes it easy to display results from API webservices that take page and per_page parameters.

e.g. Flickr API :


The demo project also includes a UITableView that automatically loads the next page of results as you scroll down.


The code for the flickr api example is inside the demo project.

NMPaginator with Flickr API

How to install


Copy NMPaginator.h and NMPaginator.m to your project. That's it.

How to use

Custom Paginator Class

You need to sublass NMPaginator and implement the fetchResultsWithPage:pageSize: method :

// MyPaginator.h
#import <Foundation/Foundation.h>
#import "NMPaginator.h"
@interface MyPaginator : NMPaginator

// MyPaginator.m
#import "MyPaginator.h"
@interface MyPaginator() {
- (void)receivedResults:(NSArray *)results total:(NSInteger)total;
- (void)failed;

@implementation MyPaginator
- (void)fetchResultsWithPage:(NSInteger)page pageSize:(NSInteger)pageSize
    // you code goes here
    // once you receive the results for the current page, just call [self receivedResults:results total:total];


In your ViewController, you can instantiate the paginator like this :

// ViewController.m
self.myPaginator = [[MyPaginator alloc] initWithPageSize:10 delegate:self];

And ask for results like this :

// ViewController.m
[self.myPaginator fetchNextPage];

You will get the results through the delegate method :

// ViewController.m
- (void)paginator:(id)paginator didReceiveResults:(NSArray *)results 
    // handle new results


My name is Nicolas Mondollot, you can follow me on twitter.

To demonstrate NMPaginator, I used the FlickFetcher class from the great Stanford CS193P course.


Do whatever you want with this piece of code (commercially or free). Attribution would be nice though.