• Stars
    star
    406
  • Rank 103,207 (Top 3 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created almost 10 years ago
  • Updated almost 9 years ago

Reviews

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

Repository Details

Subclass of UIImageView to drive easy animations (manual rotation, Carousel, GIF support)

My other works

[http://leverdeterre.github.io] (http://leverdeterre.github.io)

JMAnimatedImageView

JMAnimatedImageView is a performant subclass of UIImageView:

  • Plays huge image animation using a minimum memory pressure,
  • Allows manual interactions with imageView to drive manualy animations,
  • Can use has a Carousel,
  • GIF are supported to load your animations.

Change Log

0.2.4 :

  • Improve documentation
  • Fix retain cycle (Thanks Instruments!)
  • JMGif allocation for a better integration with your favorites network libraries.

Installation

Simply replace your UIImageView instances with instances of JMAnimatedImageView.

If using CocoaPods, the quickest way to try it out is to type this on the command line:

$ pod try JMAnimatedImageView

Usage

For a local animation using file from a bundle

In your code, #import "JMAnimatedImageView.h" and #import "JMAnimatedImageView.h"

//GIF example
@property (weak, nonatomic) IBOutlet JMAnimatedImageView *jmImageView;

[self.jmImageView reloadAnimationImagesFromGifNamed:@"rock"];
self.jmImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
[self.jmImageView startAnimating];
//PNG example with manual animation
@property (weak, nonatomic) IBOutlet JMAnimatedImageView *jmImageView;

self.jmImageView.animationDelegate = self;
self.jmImageView.animationDatasource = self;
[self.jmImageView reloadAnimationImages]; //<JMOImageViewAnimationDatasource>
self.jmImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
self.jmImageView.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
[self.jmImageView startAnimating];

For a remote Gif

@property (weak, nonatomic) IBOutlet JMAnimatedImageView *jmImageView;

[[JMApi sharedApi] downloadYourGifFileHasData:^(NSData *gifData) {
	self.animatedImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
    self.animatedImageView.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
   	[self.animatedImageView reloadAnimationImagesFromGifData:gifData fromUrl:url];
     [self.animatedImageView startAnimating];
}];	

For a remote Gif using AFNetworking

    NSURLRequest *req = [NSURLRequest requestWithURL:url];
	
    AFHTTPRequestOperation *postOperation = [[AFHTTPRequestOperation alloc] initWithRequest:req];
    [postOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
		self.animatedImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
    	self.animatedImageView.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
   		[self.animatedImageView reloadAnimationImagesFromGifData:responseObject fromUrl:url];
     	[self.animatedImageView startAnimating];

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Image error: %@", error);
        block(NO, nil);
    }];
    
	[postOperation start];

Customizations

  • AnimationType
typedef NS_ENUM(NSUInteger, JMAnimatedImageViewAnimationType) {
    JMAnimatedImageViewAnimationTypeInteractive = 0,
    
    //Animation, carousel effect
    JMAnimatedImageViewAnimationTypeManualSwipe,
    
    //Automatic rotation, use animationDuration + animationRepeatCount
    JMAnimatedImageViewAnimationTypeAutomaticLinear,    
    JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition,
    JMAnimatedImageViewAnimationTypeAutomaticReverse,
};
  • MemoryOption
typedef NS_ENUM(NSUInteger, JMAnimatedImageViewMemoryOption) {
    JMAnimatedImageViewMemoryLoadImageSystemCache = 0,  //images memory will be retain by system
    JMAnimatedImageViewMemoryLoadImageLowMemoryUsage,   //images loaded but not retained by the system
    JMAnimatedImageViewMemoryLoadImageCustom            //images loaded by you (JMOImageViewAnimationDatasource)
};
  • ImageViewOrder
typedef NS_ENUM(NSUInteger, JMAnimatedImageViewOrder) {
    JMAnimatedImageViewOrderNormal = 1,
    JMAnimatedImageViewOrderReverse = -1
};

Multi Gif and animation type (top interactive, leff automatic swipe effect, right automatic without animation)

Image

JMimageView can generate Carousels

Image

JMimageView allows interactive animations

Image

TODO

More Repositories

1

CalendarIOS7

Calendar component for iOS apps
Objective-C
560
star
2

JMHoledView

A view design to be filled with holes ...
Objective-C
546
star
3

PermissiveResearch

An iOS search engine that allows mistakes in the searched element.
Objective-C
410
star
4

JMActionSheetDescription

ActionSheet and UIActivityViewController replacement, using a descriptor component.
Objective-C
334
star
5

iAppInfos

iAppInfos allows a easy access to ALL important App informations : iOS version, Device model, Free Disk Space, Mobile provisionning infos
Objective-C
190
star
6

CustomScrollIndicator

iOS custom ScrollIView indicator
Objective-C
183
star
7

UINavigationControllerWithCompletionBlock

The UINavigationControllerWithCompletionBlock missing API !
Objective-C
139
star
8

JMOTableViewDescription

JMOTableViewDescription is an Objective-C library for easily creating and manage complex structured tableView.
Objective-C
73
star
9

LanguagesManager

An easy way to control manually the language in your application
Objective-C
64
star
10

JMCache

JMCache is a key/value store designed for persisting temporary objects. Particularities?? (NSCoding is not mandatory, you can add custom transformer to secure your data)
Objective-C
61
star
11

SecureMappingKit

Securize the mapping between your JSON and your model.
Objective-C
39
star
12

JMFormDescription

JMFormDescription is an Objective-C library for easily creating and manage complex structured Form.
Objective-C
31
star
13

JMImageScanning

Basic ocr recognition to hack secure keyboards
Objective-C
26
star
14

conference-download-scripts

Amazing videos are available but i want to see it offline
Shell
13
star
15

JMSystemNotifications

JMSystemNotifications is an Objective-C library for easily register/unregister OS System notifications
Objective-C
9
star
16

JMCrashIfResign

JMCrashIfResign is a way to protect your application against bad usage
Objective-C
8
star
17

postman

Postman iOS app to edit/execute Postman collections
Objective-C
7
star
18

ApplicationLoader-Errors

A lot of errors can occurs during Application submission !
7
star
19

JMDynamicDeviceName

JMDynamicDeviceName
Shell
4
star
20

MediaPickerManager

Shared object that allow to simplify UIImagePickerController
Objective-C
4
star
21

shakeMyApps-appScan-blog

HTML
3
star
22

DesignPatterns

Cocoa common design patterns
Objective-C
2
star
23

MaryToastin

Toast component using MaryPopin module
Objective-C
2
star
24

HexaColor

A library to parse Hexa string colors
Shell
1
star
25

JMAnimationDescription

Describe your animation, i'm doing it
Objective-C
1
star
26

bitly_ios_sdk

Objective-C
1
star
27

OneSignal-NodeJS-SDK

1
star
28

twitterCleaner

A simple OSX command line to purge yours "friends" (after an account hack for example ... in my case)
Objective-C
1
star
29

try_git

1
star
30

xctool-log2junit

A tool to convert your Xcodebuild tests output to a JUnit formated results
Shell
1
star