Git Product home page Git Product logo

olimageview's Introduction

#OLImageView (and OLImage)

You love GIFs right? so do I!. Well, as you may know Apple's implementation of UIImage doesn't support animated GIFs (Booooooo!) and that's what this classes are for.

This classes are drop-in replacements for UIImage and UIImageView respectively.

##Why this classes

When I created this classes there were a bunch of classes that added GIF support but had these issues:

  • They divided evenly the total delay between frames (Yeah, usually GIFs have even delays but when they don't...)
  • Loaded synchronously. Which is fine except the process per frame is heavy, and only when finished the image was visible.

But even having resolved those issues the experience wasn't how we are used to them.

After a little of digging I found out the browsers changed the delays on certain condition. Mostly bad encoded GIFs. This implementation adopts those conditions to provide a consistent experience with the browsers.

##How to use

Replace UIImageView for OLImageView and add the header.

Example

//Before (in your viewController in this example)
- (void)loadView 
{
	[super loadView];
	self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,200,200)];
	[self.view addSubview:self.imageView];
}



//After

#import "OLImageView.h"
- (void)loadView 
{
	[super loadView];
	self.imageView = [[OLImageView alloc] initWithFrame:CGRectMake(0,0,200,200)];
	[self.view addSubview:self.imageView];
}

No, we are not done yet. Now, when you create your image instances to put in the view you show do it with the data.

Example

- (void)loadReceivedImageData:(NSData *)data;
{
	UIImage *image = [OLImage imageWithData:data];
	self.imageView.image = image;
}

##Help us make this better

Found a bug? a typo? Can you make the decoding faster?. Feel free to fork it and send a pull request (or file an issue).

olimageview's People

Contributors

dtorres avatar nickoneill avatar

Watchers

Oz avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.