Skip to content
프로젝트

소개

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

웹 및 앱 개발

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
-1
in 15 days
-1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

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

관련 프로젝트 살펴보기

불러오는 중…