• Stars
    star
    254
  • Rank 160,264 (Top 4 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A category on UIView that allows you to progressively download images. Leverages AFNetworking's image cache to make seamless image enhancements really easy.

AFProgressiveImageDownload

A category on UIView that allows you to progressively download images. Leverages AFNetworking's image cache to make seamless image enhancements really easy.

Why is this useful?

It is common to download smaller images for use as thumbnails when rendering many records in a table view. When you visit the detail for a given page, you'd like to download a higher resolution image, but use the one we've already downloaded as a starting point, so the user doesn't get a flash of no content when the detail view controller loads.

This leverages AFNetworking's image cache, so all you need is a set of progressively enhanced URLs. It supports any number of requests, but you'll probably only use 2 (small/large).

Requirements

  • iOS 6.0
  • AFNetworking

Installation

Install via CocoaPods. Here's a sample Podfile:

platform :ios, '6.0'

pod 'AFNetworking'
pod 'AFProgressiveImageDownload'

Then run pod install to integrate it with your Xcode project.

Usage

Import the header:

#import "UIImageView+AFProgressiveDownload.h"

Prepare a list of URLs:

NSArray *urls = @[ smallUrl, largeUrl ];

Load it on the image view:

[self.imageView setImageProgressivelyWithImageURLs:progressiveURLS
                                      placeholderImage:self.placeholderImage
                                            completion:^(NSURL *imageURL, BOOL success, NSError *error, BOOL completed) {
                                                NSLog(@"Completed %@", imageURL);

                                                // just to make the effect more obvious
                                                sleep(1);
    }];

Demo

Check out the provided sample project for a live demo. Here's what it looks like:

Loading the first image Loading the second image

It's hard to see with scaled down images, but the one on the right is retina resolution.

License

AFProgressiveImageDownload is provided under the MIT license. See LICENSE for specifics.

Attribution

This library is made possible by AFNetworking, which is doing all of the heavy lifting here. The demo project uses Creative Commons licensed images. Credits to Eugene Kukulka and WPZOOM.

Created as part of the Objective-C Hackathon on June 29th, 2013.

More Repositories

1

nsscreencast

Moved to https://github.com/nsscreencast
719
star
2

nsdateformatter.com

Source code for nsdateformatter.com. Built with Swift using Vapor. Hosted on Heroku.
JavaScript
191
star
3

BSModalPickerView

A custom view component that presents a UIPickerView with a simple list of options, along with a toolbar for Done/Cancel and a faded backdrop view.
Objective-C
55
star
4

visualizing-bezier-curves

An Xcode Playground for visualizing how BΓ©zier curves work
Swift
37
star
5

cocoa-conf-jenkins

The sample project for build automation using Jenkins as the continuous integration server. Presented at CocoaConf Chicago in 2013.
Objective-C
24
star
6

swift-add

Easily add swift packages from the command line
Swift
23
star
7

dotfiles

Various dotfiles I use on my machines.
Vim Script
20
star
8

advanced-codable-talk

Example code for my Advanced Codable Talk
Swift
18
star
9

minesweeper-swift

Minesweeper - written in Swift and SpriteKit, streamed live on Twitch
Swift
12
star
10

pong

A pong game, written in Ruby using Gosu.
Ruby
11
star
11

MagicalFactory

An object builder framework for building up objects for use in automated tests for Objective-C projects.
Objective-C
9
star
12

swift-rock-paper-scissors

A demo Swift application (CLI and web) that generates Rock-Paper-Scissors responses. Runs on Linux.
Swift
9
star
13

cocoa-conf-afnetworking

A sample App.net client using AFNetworking, presented at CocoaConf Chicago in 2013.
Objective-C
8
star
14

best-latte-server

A sample Rails API that hosts pictures of people's lattes. It's as revolutionary and amazing as it sounds.
Ruby
6
star
15

yow-connected-effective-networking

Application sample code from demos given in my YOW! Connected talk in Melbourne, Australia
Swift
6
star
16

tic-tac-toe

A tic-tac-toe game made with Ruby
Ruby
6
star
17

tekpub-iphone-series

iPhone code that is part of the Tekpub iPhone series
Objective-C
6
star
18

intown

A client for the Bands in Town API (version 2.0)
Ruby
5
star
19

puppeteer-karaoke-version

A utility to automate downloading tracks
JavaScript
5
star
20

devteach2012-metroid-runner

A sample game demonstrating how to build games on iOS using cocos2d. Presented at DevTeach in Vancouver, May 2012.
Objective-C
5
star
21

mdevcon-afnetworking

AFNetworking App.net client, used as an example during mdevcon 2013.
Objective-C
4
star
22

cocoa-conf-boston-2014

Example apps used in my presentations at CocoaConf Boston 2014.
Swift
4
star
23

hiveboard

An iPad prototype for the game Hive
Objective-C
4
star
24

iphonedevcon-sandiego

Code & Slides from iPhone Dev Con 2010 in San Diego
Objective-C
3
star
25

altnetgitdemo

Demoing git for ALT.NET Houston
Ruby
3
star
26

iphonedevcon-boston

Slides & Code Samples from my talks at iPhone Dev Con in Boston, April 2011
Objective-C
3
star
27

cocoaconf-austin-2016

Swift on Linux sample code / configuration
Swift
3
star
28

houston-tech-fest-2011

Code & Slides for sessions presented at Houston Tech Fest 2011
Ruby
3
star
29

Parse

Mirror of the Parse iOS framework
Objective-C
2
star
30

Pollinate

A Titanium app for conferences built during the ChaiONE hack-day
Ruby
2
star
31

SimpleTodo

A simple demo todo application in Swift 5 / iOS 12
Swift
2
star
32

ios-extensions-demo

Extensions Demo Project
Swift
2
star
33

breakout

a breakout clone written in Ruby
Ruby
2
star
34

Experiments

my personal junkbox of code
C#
2
star
35

ios-8-networking

A kitchen sink demo app showing off features of iOS 8 networking
Swift
2
star
36

vapor-add-migration

A script to generate vapor migrations, similar to Rails.
Swift
2
star
37

code-mag-twitter-searcher

An example iPhone application that searches twitter. Published in Code Magazine.
Objective-C
2
star
38

authenticate.iphone

JanRain Authenticate for the iphone
Objective-C
1
star
39

nsspain-2021-modular-architecture

Demos from my talk on Modular Application Architecture at NSSpain 2021
Swift
1
star
40

MovieLister

An example app for Swift Networking, written for Swift for Good
Swift
1
star
41

mods-2013

Sample code for presentations delivered at Mobile Developer Summit, October 10-11 in Bangalore, India
Objective-C
1
star
42

devteach2012-linky

Rails app that uses Delayed Job and Resque to demonstrate background jobs in Ruby apps. Presented at DevTeach 2012 in Vancouver, May 2012.
Ruby
1
star
43

mux-ruby

An unofficial ruby client for the mux.com api.
Ruby
1
star
44

nsscreencast-shared-credentials-demo-server

A sinatra app used to demonstrate shared web credentials with iOS apps
Ruby
1
star
45

tvOS-workshop

a 1-day tvOS Workshop presented at pragmaconf 2016 in Verona, Italy.
Swift
1
star
46

beer-lookup

A Sinatra application that consumes the BreweryDB API to provide beer search results.
Ruby
1
star
47

subdigital.github.com

JavaScript
1
star
48

advent-of-code

Swift
1
star