Latest 0.1.8
License MIT
Platforms ios 6.0

CI Status


Paging and zooming            Web image

Parallax Scrolling1     Parallax Scrolling2


AFTPhotoScroller is a simple and flexible solution for implementing a photo scroller with the basic functionality in iOS photo app.

The inspiration of this is from WWDC 2010 video Designing Apps with Scroll Views, which explains the essence of nested scroll views technique for photo scrolling. There are some great open source projects wrapping everything to make photo scrolling code simple to implement, but AFTPhotoScroller is different.

Like classic photo scroller, AFTPhotoScroller can do left to right page scrolling and single photo zooming. The features of AFTPhotoScroller are:

Controller-Free Design.

Unlike UIPageViewController, there is no controller class for AFTPhotoScroller. This is a view-based public interface and the only one needed class is called AFTPagingScrollView, which means you can do much customized controller for different situations like using UITableView directly instead of UITableViewController. It handles the page reuse, padding calculation and minimum image cache concept just like UIPageViewController, except the page curl effect and spine location.


There are a lot of details for you to customize:

  • Padding between pages
  • Enable / disable the double tap gesture to zoom image
  • Set zooming progress to determine how far a double tap can zoom.
  • Vertical paging direction support
  • Parallax Scrolling support (like photo app in iOS 10. Check out wikipedia for the concept of Parallax Scrolling if you like)

There are a lot of control flows for you to customize:

  • You can decide whether should display a single page
  • You can jump to specified page directly
  • You can reload a single page (It works well with image network fetching)
  • You can get callback for beginning states of paging, zooming, tapping.
  • You can get callback after a new page is about to fully displayed on screen (When a new page is taken more than half of the screen)



First, install AFTPhotoScroller.
Then #import <AFTPhotoScroller/AFTPhotoScroller.h>
In your UIViewController subclass, you can simply just do this.

- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets = NO;

    self.pagingView = [[AFTPagingScrollView alloc] initWithFrame:self.view.bounds];
    self.pagingView.dataSource = self;
    self.pagingView.paddingBetweenPages = 6;
    [self.view addSubview:self.pagingView];

    self.images = ... // load images
    [self.pagingView reloadData]; // build UI and load required data

#pragma mark - AFTPagingScrollViewDataSource

- (NSInteger)numberOfPagesInPagingScrollView:(AFTPagingScrollView *)pagingScrollView {
    return self.images.count;

- (UIImage *)pagingScrollView:(AFTPagingScrollView *)pagingScrollView imageForPageAtIndex:(NSInteger)pageIndex {
    return self.images[pageIndex];


First, install AFTPhotoScroller (MUST use_frameworks! in Podfile)
Then import AFTPhotoScroller
In your UIViewController subclass, you can simply just do this.

import UIKit
import AFTPhotoScroller

class ViewController: UIViewController, AFTPagingScrollViewDataSource {

    var pagingView: AFTPagingScrollView!
    var images: [UIImage]!

    override func viewDidLoad() {

        pagingView = AFTPagingScrollView(frame:view.bounds)
        pagingView.isParallaxScrollingEnabled = true
        pagingView.dataSource = self

        images = loadAllImages()

    public func numberOfPages(in pagingScrollView: AFTPagingScrollView) -> Int {
        return images.count

    public func pagingScrollView(_ pagingScrollView: AFTPagingScrollView, imageForPageAt pageIndex: Int) -> UIImage {
        return images[pageIndex]

    func loadAllImages() -> [UIImage] {

The demo app is available for downloading. It is showing how to build different photo scrollers by AFTPhotoScroller. It works well with other UI component like custom bottom page bar. The demo is using presented navigation bar with push animation instead of real UINavigationController.

Unlike demo app, we do not recommend loading all image resources into memory at once in real project.


iOS 6+


AFTPhotoScroller is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "AFTPhotoScroller"



huangkun, [email protected]


AFTPhotoScroller is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "AFTPhotoScroller",
    "version": "0.1.8",
    "summary": "A simple photo scrolling view using like iOS photo app.",
    "description": "This photo scrolling view can provide features such as:n1. Controller free.n2. Both horizontal and vertical page scrolling.n3. Parallax Scrolling Support.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "huangkun": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.8"
    "social_media_url": "",
    "platforms": {
        "ios": "6.0"
    "source_files": "AFTPhotoScroller/Classes/**/*"

Pin It on Pinterest

Share This