/JMAnimatedImageView

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

Primary LanguageObjective-CMIT LicenseMIT

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.

Installation & Usage

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

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 = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutAnimation;
[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 = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutAnimation;
self.jmImageView.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;

Some parameters :

  • AnimationType
typedef NS_ENUM(NSUInteger, JMAnimatedImageViewAnimationType) {
    //Animation is done by a gesture
    JMAnimatedImageViewAnimationTypeInteractive = 0,
    
    //Animation, carousel effect
    JMAnimatedImageViewAnimationTypeManualSwipe, 
    
    //Automatic rotation, use animationDuration + animationRepeatCount
    JMAnimatedImageViewAnimationTypeAutomaticLinear,    
    JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutAnimation,
    JMAnimatedImageViewAnimationTypeAutomaticReverse,
};
  • MemoryOption
typedef NS_ENUM(NSUInteger, JMAnimatedImageViewMemoryOption) {
    //images memory will be retain by system
    JMAnimatedImageViewMemoryLoadImageSystemCache = 0, 
    
    //image are loaded in live
    JMAnimatedImageViewMemoryLoadImageLowMemoryUsage,
    
    //you load your images has you want
    JMAnimatedImageViewMemoryLoadImageCustom
};
  • ImageViewOrder
typedef NS_ENUM(NSUInteger, JMAnimatedImageViewOrder) {
    JMAnimatedImageViewOrderNone = 0,
    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