Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help #4

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3567743
Migrate to ARC to remove leak allocations.
RomanTruba Apr 5, 2014
45441af
Update and rename README to README.md
RomanTruba Apr 5, 2014
dce9c42
Update README.md
RomanTruba Apr 5, 2014
5a23b91
Changed delegate method to identify image URL
RomanTruba Apr 5, 2014
19fb074
Loading with progress. Delegate replaces with events. Progress view. …
RomanTruba Apr 5, 2014
d62e772
Update README.md
RomanTruba Apr 5, 2014
4d4e11a
Update README.md
RomanTruba Apr 6, 2014
78505ef
Update README.md
RomanTruba Apr 6, 2014
c8e5850
Update README.md
RomanTruba Apr 6, 2014
1dceb7e
Update README.md
RomanTruba Apr 6, 2014
8fc62e9
Created dispatch queue
RomanTruba Apr 6, 2014
c4579c8
Updated example
RomanTruba Apr 6, 2014
446ecc8
Merge remote-tracking branch 'origin/master'
RomanTruba Apr 6, 2014
c9309a8
Update README.md
RomanTruba Apr 6, 2014
82c5a09
New blocks. Rewrited some parts. Rewrited example
RomanTruba Apr 6, 2014
1cc26a7
Git ignore
RomanTruba Apr 6, 2014
5bb43d9
Many changes. Rewrited to decrease memory usage.
RomanTruba Apr 6, 2014
7cb3852
Update README.md
RomanTruba Apr 6, 2014
2dd0063
Return events of start and finish loading
RomanTruba Apr 6, 2014
3852d42
Merge remote-tracking branch 'origin/master'
RomanTruba Apr 6, 2014
6364753
Update README.md
RomanTruba Apr 6, 2014
be491f0
Fix for restore previous canvas
RomanTruba Apr 7, 2014
5723e21
Release version. Many improvements
RomanTruba Apr 7, 2014
17d8aee
License issue
RomanTruba Apr 7, 2014
bf76b3e
Update readme
RomanTruba Apr 7, 2014
bf0f91e
Delegate method for animation loop count added
rishi420 Apr 30, 2014
4fd4d9f
Merge pull request #1 from rishi420/master
RomanTruba May 8, 2014
247634f
Fix for disposal methods 2 and 3. Also made minimal framerate=5 inste…
RomanTruba Aug 19, 2014
e6bf1c7
Thread sleep after frame, not before
RomanTruba Aug 19, 2014
7fddc98
Refactoring, rewrited example, prepare for cocoapods
RomanTruba Dec 24, 2014
ef9b702
Refactoring, rewrited example, prepare for cocoapods
RomanTruba Dec 24, 2014
aa23f3d
Added license file
RomanTruba Dec 24, 2014
52e4cc3
Prepared to be a pod
RomanTruba Dec 24, 2014
6ec1478
Fixed podspec
RomanTruba Dec 24, 2014
5cbd13c
Update README.md
Dec 24, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#OS noise
profile
[Tt]humbs.db
*.DS_Store
*~
*.swp
*.out
*.bak*
*.lock

#Other CSM
.hg
.svn
CVS

#Xcode noise
*.log
*~.nib
*.moved-aside
**/*.xcodeproj/*
**/!*.xcodeproj/project.pbxproj
**/*.xcworkspace/*
**/!*.xcworkspace/contents.xcworkspacedata
!xcshareddata
xcuserdata
VKSdkWorkspace.xcworkspace/xcshareddata/

#Project files
[Bb]uild/
DerivedData/

#CocoaPods
Pods

#AppCode
*/.idea/*
.idea/*
13 changes: 13 additions & 0 deletions Animated-Gif-iOS.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Pod::Spec.new do |s|
s.name = "Animated-Gif-iOS"
s.version = "1.1.0"
s.summary = "A special supporting class for playing GIF animations inline without creating all frames at once. Decodes animation frames on the fly"
s.homepage = "https://github.com/Dreddik/Animated-GIF-iPhone.git"
s.license = 'MIT'
s.author = { "Roman Truba" => "[email protected]", "Stijn Spijker" => "(http://www.stijnspijker.nl/", }
s.source = { :git => "https://github.com/Dreddik/Animated-GIF-iPhone.git", :tag => s.version.to_s }
s.platform = :ios, '5.0'
s.source_files = 'AnimatedGif/*.{h,m}'
s.frameworks = 'Foundation','UIKit'
s.requires_arc = true
end
87 changes: 87 additions & 0 deletions AnimatedGif/AnimatedGif.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//
// AnimatedGif2.h
//
// Created by Stijn Spijker on 05-07-09.
// Upgraded by Roman Truba on 2014
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
static NSString * const AnimatedGifLoadingProgressEvent = @"AnimatedGifLoadingProgressEvent";
static NSString * const AnimatedGifDidStartLoadingingEvent = @"AnimatedGifDidStartLoadingingEvent";
static NSString * const AnimatedGifDidFinishLoadingingEvent = @"AnimatedGifDidFinishLoadingingEvent";
static NSString * const AnimatedGifRemovedFromSuperview = @"AnimatedGifRemovedFromSuperview";

@class AnimatedGif;

@protocol AnimatedGifDelegate <NSObject>

- (void)animationWillRepeat:(AnimatedGif *)animatedGif;

@end

/**
* Class for enqueing gif loading requests. Also, it keeps gif data info
*/
@interface AnimatedGifQueueObject : NSObject <NSURLConnectionDataDelegate>
{
long long expectedGifSize;
}
/// URL of gif been loaded
@property (nonatomic, strong) NSURL *url;
/// Data of gif
@property (nonatomic, strong) NSData *data;
/// Current network gif download progress
@property (nonatomic, assign) CGFloat loadingProgress;

@end

/**
* Class for creating animated gif playback.
*/
@interface AnimatedGif : NSObject

@property (nonatomic, assign) id<AnimatedGifDelegate> delegate;

/// Progress block will be called when GIF is loading from network.
@property (nonatomic, copy) void(^loadingProgressBlock)(AnimatedGif *object, CGFloat progressLevel);
/**
* This block will be called when we are ready to show first frame of animation.
* You can use it to correctly size your parent UIImageView.
* First frame of animation will be passed in frame.
* Also, animationSize property will be set before this block invokation.
*/
@property (nonatomic, copy) void(^willShowFrameBlock)(AnimatedGif *object, UIImage * frame);
/// URL of current animation gif if it was passed
@property (nonatomic, readonly) NSURL *url;
/// Size of current animation GIF. Will be set only after loading and first frame processed
@property (nonatomic, assign) CGSize animationSize;
/// Image view where animation will be shown
@property (nonatomic, weak) UIImageView * parentView;

/// Creates new animation from URL. It may be local file URL, or web URL
+ (AnimatedGif*) getAnimationForGifAtUrl: (NSURL *) animationUrl;
/// Creates new animation with GIF data
+ (AnimatedGif*) getAnimationForGifWithData:(NSData*) data;
/// Starts animation process (loading -> preparing -> display)
- (void) start;
/// Stops current animation
- (void) stop;

@end
Loading