├── JMAnimatedImageView.podspec
├── JMAnimatedImageView
├── JMAnimatedImageView.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── JMAnimatedImageView.xccheckout
│ │ └── xcuserdata
│ │ │ └── jeromemorissard.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata
│ │ └── jeromemorissard.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── JMAnimatedImageView.xcscheme
│ │ └── xcschememanagement.plist
├── JMAnimatedImageView
│ ├── Base.lproj
│ │ └── Main.storyboard
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-120.png
│ │ │ ├── Icon-Small@2x.png
│ │ │ └── Icon-Spotlight-iOS7@2x.png
│ │ └── LaunchImage.launchimage
│ │ │ └── Contents.json
│ ├── JMAnimatedImageView-Info.plist
│ ├── JMAnimatedImageView-Prefix.pch
│ ├── JMAnimatedImageView
│ │ ├── JMAmimatedImageViewMacro.h
│ │ ├── JMAnimatedImageView+Image.h
│ │ ├── JMAnimatedImageView+Image.m
│ │ ├── JMAnimatedImageView.h
│ │ ├── JMAnimatedImageView.m
│ │ ├── JMAnimatedLog.h
│ │ ├── JMAnimationOperation.h
│ │ ├── JMAnimationOperation.m
│ │ ├── JMGif.h
│ │ ├── JMGif.m
│ │ ├── JMOImageViewAnimationDatasource.h
│ │ ├── JMOImageViewAnimationDelegate.h
│ │ ├── UIImage+JM.h
│ │ └── UIImage+JM.m
│ ├── JMAppDelegate.h
│ ├── JMAppDelegate.m
│ ├── JMFLViewController.h
│ ├── JMFLViewController.m
│ ├── JMFLViewController.xib
│ ├── JMRamViewController.h
│ ├── JMRamViewController.m
│ ├── JMRamViewController.xib
│ ├── JMTableViewCell.h
│ ├── JMTableViewCell.m
│ ├── JMTableViewController.h
│ ├── JMTableViewController.m
│ ├── JMViewController.h
│ ├── JMViewController.m
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ ├── iAppInfos
│ │ ├── AppInformationsManager.h
│ │ ├── AppInformationsManager.m
│ │ ├── JMODevicePowerInfos.h
│ │ ├── JMODevicePowerInfos.m
│ │ ├── JMOLogMacro.h
│ │ ├── JMOMobileProvisionning.h
│ │ ├── JMOMobileProvisionning.m
│ │ ├── NSDictionary+iAppInfos.h
│ │ ├── NSDictionary+iAppInfos.m
│ │ ├── UIApplication+iAppInfos.h
│ │ ├── UIApplication+iAppInfos.m
│ │ ├── UIDevice+iAppInfos.h
│ │ └── UIDevice+iAppInfos.m
│ ├── images
│ │ ├── VergePhotos
│ │ │ ├── 0_verge_super_wide.jpg
│ │ │ ├── 10_verge_super_wide.jpg
│ │ │ ├── 1_verge_super_wide.jpg
│ │ │ ├── 2_verge_super_wide.jpg
│ │ │ ├── 3_verge_super_wide.jpg
│ │ │ ├── 4_verge_super_wide.jpg
│ │ │ ├── 5_verge_super_wide.jpg
│ │ │ ├── 6_verge_super_wide.jpg
│ │ │ ├── 7_verge_super_wide.jpg
│ │ │ ├── 8_verge_super_wide.jpg
│ │ │ └── 9_verge_super_wide.jpg
│ │ ├── gifs
│ │ │ ├── Rotating_earth.gif
│ │ │ ├── nyan.gif
│ │ │ └── rock.gif
│ │ ├── zoom_1920_0.jpg
│ │ ├── zoom_1920_1.jpg
│ │ ├── zoom_1920_10.jpg
│ │ ├── zoom_1920_11.jpg
│ │ ├── zoom_1920_12.jpg
│ │ ├── zoom_1920_13.jpg
│ │ ├── zoom_1920_14.jpg
│ │ ├── zoom_1920_15.jpg
│ │ ├── zoom_1920_16.jpg
│ │ ├── zoom_1920_17.jpg
│ │ ├── zoom_1920_18.jpg
│ │ ├── zoom_1920_19.jpg
│ │ ├── zoom_1920_2.jpg
│ │ ├── zoom_1920_20.jpg
│ │ ├── zoom_1920_21.jpg
│ │ ├── zoom_1920_22.jpg
│ │ ├── zoom_1920_23.jpg
│ │ ├── zoom_1920_24.jpg
│ │ ├── zoom_1920_25.jpg
│ │ ├── zoom_1920_26.jpg
│ │ ├── zoom_1920_27.jpg
│ │ ├── zoom_1920_28.jpg
│ │ ├── zoom_1920_29.jpg
│ │ ├── zoom_1920_3.jpg
│ │ ├── zoom_1920_30.jpg
│ │ ├── zoom_1920_31.jpg
│ │ ├── zoom_1920_32.jpg
│ │ ├── zoom_1920_33.jpg
│ │ ├── zoom_1920_34.jpg
│ │ ├── zoom_1920_35.jpg
│ │ ├── zoom_1920_36.jpg
│ │ ├── zoom_1920_37.jpg
│ │ ├── zoom_1920_38.jpg
│ │ ├── zoom_1920_39.jpg
│ │ ├── zoom_1920_4.jpg
│ │ ├── zoom_1920_40.jpg
│ │ ├── zoom_1920_41.jpg
│ │ ├── zoom_1920_42.jpg
│ │ ├── zoom_1920_43.jpg
│ │ ├── zoom_1920_44.jpg
│ │ ├── zoom_1920_45.jpg
│ │ ├── zoom_1920_46.jpg
│ │ ├── zoom_1920_47.jpg
│ │ ├── zoom_1920_48.jpg
│ │ ├── zoom_1920_49.jpg
│ │ ├── zoom_1920_5.jpg
│ │ ├── zoom_1920_50.jpg
│ │ ├── zoom_1920_51.jpg
│ │ ├── zoom_1920_52.jpg
│ │ ├── zoom_1920_53.jpg
│ │ ├── zoom_1920_54.jpg
│ │ ├── zoom_1920_55.jpg
│ │ ├── zoom_1920_56.jpg
│ │ ├── zoom_1920_57.jpg
│ │ ├── zoom_1920_58.jpg
│ │ ├── zoom_1920_59.jpg
│ │ ├── zoom_1920_6.jpg
│ │ ├── zoom_1920_60.jpg
│ │ ├── zoom_1920_61.jpg
│ │ ├── zoom_1920_62.jpg
│ │ ├── zoom_1920_63.jpg
│ │ ├── zoom_1920_64.jpg
│ │ ├── zoom_1920_65.jpg
│ │ ├── zoom_1920_66.jpg
│ │ ├── zoom_1920_67.jpg
│ │ ├── zoom_1920_68.jpg
│ │ ├── zoom_1920_69.jpg
│ │ ├── zoom_1920_7.jpg
│ │ ├── zoom_1920_70.jpg
│ │ ├── zoom_1920_71.jpg
│ │ ├── zoom_1920_72.jpg
│ │ ├── zoom_1920_8.jpg
│ │ └── zoom_1920_9.jpg
│ └── main.m
└── JMAnimatedImageViewTests
│ ├── JMAnimatedImageViewTests-Info.plist
│ ├── JMAnimatedImageViewTests.m
│ └── en.lproj
│ └── InfoPlist.strings
├── LICENCE
├── README.md
└── Screens
├── JMImageViewCarousel.png
├── JMImageViewRotation.gif
├── JMimageViewCarousel.gif
└── gif_experiments.gif
/JMAnimatedImageView.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'JMAnimatedImageView'
3 | s.version = '0.2.4'
4 | s.requires_arc = true
5 | s.author = {
6 | 'Morissard Jérome' => 'morissardj@gmail.com'
7 | }
8 | s.ios.deployment_target = '6.0'
9 | s.summary = 'JMAnimatedImageView is a subclass of UIImageView to drive easy animations (interactive animations, Carousels, GIF support)'
10 | s.license = { :type => 'MIT' }
11 | s.homepage = 'https://github.com/leverdeterre/JMAnimatedImageView'
12 | s.source = {
13 | :git => 'https://github.com/leverdeterre/JMAnimatedImageView.git',
14 | :tag => "0.2.4"
15 | }
16 | s.source_files = 'JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/*'
17 | end
18 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView.xcodeproj/project.xcworkspace/xcshareddata/JMAnimatedImageView.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 72040B2C-D517-423B-A4EE-26F1B425BABD
9 | IDESourceControlProjectName
10 | JMAnimatedImageView
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 450F5453733DF52A95F83E2F50A969451CBFE488
14 | https://github.com/leverdeterre/JMAnimatedImageView.git
15 | AF35A7A83FF9099F4AF74D1E16D71D18D0829CE0
16 | https://github.com/leverdeterre/JMAnimatedImageView.git
17 |
18 | IDESourceControlProjectPath
19 | JMAnimatedImageView/JMAnimatedImageView.xcodeproj/project.xcworkspace
20 | IDESourceControlProjectRelativeInstallPathDictionary
21 |
22 | 450F5453733DF52A95F83E2F50A969451CBFE488
23 | ../../..
24 | AF35A7A83FF9099F4AF74D1E16D71D18D0829CE0
25 | ../../../..
26 |
27 | IDESourceControlProjectURL
28 | https://github.com/leverdeterre/JMAnimatedImageView.git
29 | IDESourceControlProjectVersion
30 | 111
31 | IDESourceControlProjectWCCIdentifier
32 | 450F5453733DF52A95F83E2F50A969451CBFE488
33 | IDESourceControlProjectWCConfigurations
34 |
35 |
36 | IDESourceControlRepositoryExtensionIdentifierKey
37 | public.vcs.git
38 | IDESourceControlWCCIdentifierKey
39 | AF35A7A83FF9099F4AF74D1E16D71D18D0829CE0
40 | IDESourceControlWCCName
41 |
42 |
43 |
44 | IDESourceControlRepositoryExtensionIdentifierKey
45 | public.vcs.git
46 | IDESourceControlWCCIdentifierKey
47 | 450F5453733DF52A95F83E2F50A969451CBFE488
48 | IDESourceControlWCCName
49 | JMAnimatedImageView
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView.xcodeproj/project.xcworkspace/xcuserdata/jeromemorissard.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView.xcodeproj/project.xcworkspace/xcuserdata/jeromemorissard.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView.xcodeproj/project.xcworkspace/xcuserdata/jeromemorissard.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView.xcodeproj/xcuserdata/jeromemorissard.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView.xcodeproj/xcuserdata/jeromemorissard.xcuserdatad/xcschemes/JMAnimatedImageView.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView.xcodeproj/xcuserdata/jeromemorissard.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | JMAnimatedImageView.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | C2B75322199E8802004BB1C3
16 |
17 | primary
18 |
19 |
20 | C2B75343199E8802004BB1C3
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
81 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "29x29",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-Small@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "40x40",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-Spotlight-iOS7@2x.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "60x60",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-120.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "idiom" : "ipad",
23 | "size" : "29x29",
24 | "scale" : "1x"
25 | },
26 | {
27 | "idiom" : "ipad",
28 | "size" : "29x29",
29 | "scale" : "2x"
30 | },
31 | {
32 | "idiom" : "ipad",
33 | "size" : "40x40",
34 | "scale" : "1x"
35 | },
36 | {
37 | "idiom" : "ipad",
38 | "size" : "40x40",
39 | "scale" : "2x"
40 | },
41 | {
42 | "idiom" : "ipad",
43 | "size" : "76x76",
44 | "scale" : "1x"
45 | },
46 | {
47 | "idiom" : "ipad",
48 | "size" : "76x76",
49 | "scale" : "2x"
50 | }
51 | ],
52 | "info" : {
53 | "version" : 1,
54 | "author" : "xcode"
55 | }
56 | }
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/Images.xcassets/AppIcon.appiconset/Icon-120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/Images.xcassets/AppIcon.appiconset/Icon-120.png
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-iOS7@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-iOS7@2x.png
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "ipad",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "1x"
9 | },
10 | {
11 | "orientation" : "landscape",
12 | "idiom" : "ipad",
13 | "extent" : "full-screen",
14 | "minimum-system-version" : "7.0",
15 | "scale" : "1x"
16 | },
17 | {
18 | "orientation" : "portrait",
19 | "idiom" : "ipad",
20 | "extent" : "full-screen",
21 | "minimum-system-version" : "7.0",
22 | "scale" : "2x"
23 | },
24 | {
25 | "orientation" : "landscape",
26 | "idiom" : "ipad",
27 | "extent" : "full-screen",
28 | "minimum-system-version" : "7.0",
29 | "scale" : "2x"
30 | }
31 | ],
32 | "info" : {
33 | "version" : 1,
34 | "author" : "xcode"
35 | }
36 | }
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | com.morissard.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 0.2.4
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 0.2.4
25 | LSRequiresIPhoneOS
26 |
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations~ipad
34 |
35 | UIInterfaceOrientationLandscapeLeft
36 | UIInterfaceOrientationLandscapeRight
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_5_0
10 | #warning "This project uses features only available in iOS SDK 5.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | #import
15 | #import
16 |
17 | #import "JMAppDelegate.h"
18 | #endif
19 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMAmimatedImageViewMacro.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMAmimatedImageViewMacro.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 08/09/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #ifndef JMAnimatedImageView_JMAmimatedImageViewMacro_h
10 | #define JMAnimatedImageView_JMAmimatedImageViewMacro_h
11 |
12 | // Log using the same parameters above but include the function name and source code line number in the log statement
13 | #ifdef DEBUG
14 | #define JMOLog(fmt, ...) NSLog((@"Func: %s, Line: %d, " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
15 | #else
16 | #define JMOLog(...)
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView+Image.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMAnimatedImageView+Image.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 20/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMAnimatedImageView.h"
10 |
11 | @interface JMAnimatedImageView (Image)
12 |
13 | /**
14 | * imageAtIndex: This method help to get the image for an index
15 | *
16 | * @param index NSInteger
17 | *
18 | * @return UIImage image
19 | */
20 | - (UIImage *)imageAtIndex:(NSInteger)index;
21 |
22 | /**
23 | * numberOfImages. This method return the number of images
24 | *
25 | * @return NSUInteger numberOfImages
26 | */
27 | - (NSUInteger)numberOfImages;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView+Image.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMAnimatedImageView+Image.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 20/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMAnimatedImageView+Image.h"
10 | #import "UIImage+JM.h"
11 | #import "JMGif.h"
12 |
13 | @implementation JMAnimatedImageView (Image)
14 |
15 | - (UIImage *)imageAtIndex:(NSInteger)index
16 | {
17 | if ([self isAGifImageView]) {
18 | return [self.gifObject imageAtIndex:index];
19 |
20 | } else if ([self.animationDatasource respondsToSelector:@selector(imageAtIndex:forAnimatedImageView:)]) {
21 | return [self.animationDatasource imageAtIndex:index forAnimatedImageView:self];
22 |
23 | } else if ([self.animationDatasource respondsToSelector:@selector(imageNameAtIndex:forAnimatedImageView:)]) {
24 | NSString *imgName = [self.animationDatasource imageNameAtIndex:index forAnimatedImageView:self];
25 | UIImage *img = [UIImage jm_imageNamed:imgName withOption:self.memoryManagementOption];
26 | return img;
27 | }
28 |
29 | return nil;
30 | }
31 |
32 | - (NSUInteger)numberOfImages
33 | {
34 | if ([self isAGifImageView]) {
35 | return self.gifObject.items.count;
36 | } else {
37 | if ([self.animationDatasource respondsToSelector:@selector(numberOfImagesForAnimatedImageView:)]) {
38 | return [self.animationDatasource numberOfImagesForAnimatedImageView:self];
39 | }
40 | }
41 |
42 | return 0;
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMAnimatedImageView.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "JMOImageViewAnimationDelegate.h"
11 | #import "JMOImageViewAnimationDatasource.h"
12 |
13 | #define JMDefaultGifDuration -1
14 |
15 | typedef NS_ENUM(NSUInteger, JMAnimatedImageViewAnimationType) {
16 | JMAnimatedImageViewAnimationTypeInteractive = 0,
17 | JMAnimatedImageViewAnimationTypeManualSwipe,
18 | JMAnimatedImageViewAnimationTypeAutomaticLinear, //use animationDuration + animationRepeatCount
19 | JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition, //use animationDuration + animationRepeatCount
20 | JMAnimatedImageViewAnimationTypeAutomaticReverse //use animationDuration + animationRepeatCount
21 | };
22 |
23 | typedef NS_ENUM(NSUInteger, JMAnimatedImageViewMemoryOption) {
24 | JMAnimatedImageViewMemoryLoadImageSystemCache = 0, //images memory will be retain by system
25 | JMAnimatedImageViewMemoryLoadImageLowMemoryUsage, //images loaded but not retained by the system
26 | JMAnimatedImageViewMemoryLoadImageCustom //images loaded by you (JMOImageViewAnimationDatasource)
27 | };
28 |
29 | typedef NS_ENUM(NSUInteger, JMAnimatedImageViewOrder) {
30 | JMAnimatedImageViewOrderNormal = 1,
31 | JMAnimatedImageViewOrderReverse = -1
32 | };
33 |
34 | typedef NS_ENUM(NSUInteger, UIImageViewAnimationOption) {
35 | UIImageViewAnimationOptionLinear = 0,
36 | UIImageViewAnimationOptionCurveEaseInOut
37 | };
38 |
39 | typedef NS_ENUM(NSUInteger, UIImageViewAnimationState) {
40 | UIImageViewAnimationStateStopped = 0,
41 | UIImageViewAnimationStateInPgrogress
42 | };
43 |
44 | typedef void (^JMCompletionFinishBlock)(BOOL resul);
45 |
46 | @class JMGif;
47 | @interface JMAnimatedImageView : UIImageView
48 |
49 | @property (weak, nonatomic) IBOutlet id animationDatasource;
50 | @property (weak, nonatomic) IBOutlet id animationDelegate;
51 | @property (assign, nonatomic) JMAnimatedImageViewAnimationType animationType;
52 | @property (assign, nonatomic) JMAnimatedImageViewMemoryOption memoryManagementOption;
53 | @property (assign, nonatomic) JMAnimatedImageViewOrder imageOrder;
54 | @property (assign, nonatomic) BOOL interactiveAnimation;
55 | @property (assign, nonatomic) NSInteger currentIndex;
56 | @property (assign, nonatomic) UIImageViewAnimationState animationState;
57 | @property (strong, nonatomic, readonly) dispatch_queue_t animationManagementQueue;
58 | @property (strong, nonatomic, readonly) NSOperationQueue *animationQueue;
59 |
60 | /**
61 | * reloadAnimationImages, This method will call animationDatasource
62 | */
63 | - (void)reloadAnimationImages;
64 |
65 | /**
66 | * setCurrentIndex, This method will animate the modification of image
67 | *
68 | * @param index destination index
69 | * @param animated BOOL animated
70 | */
71 | - (void)setCurrentIndex:(NSInteger)index animated:(BOOL)animated;
72 |
73 | /**
74 | * setImage, This method will force the image to the index
75 | *
76 | * @param img UIImage
77 | * @param index NSInteger index
78 | */
79 | - (void)setImage:(UIImage *)img forCurrentIndex:(NSInteger)index;
80 |
81 | /**
82 | * animateToIndex:withDuration:, This method will animate the modification of images to access to the index in parameter.
83 | *
84 | * @param index NSInteger destination index
85 | * @param duration NSTimeInterval duration
86 | */
87 | - (void)animateToIndex:(NSInteger)index withDuration:(NSTimeInterval)duration;
88 |
89 |
90 | /**
91 | * animateToIndex:withDuration:withCompletionBlock:, This method will animate the modification of images to access to the index in parameter.
92 | *
93 | * @param index NSInteger destination index
94 | * @param duration NSTimeInterval duration
95 | * @param finishBlock JMCompletionFinishBlock CompletionBlock
96 | */
97 | - (void)animateToIndex:(NSInteger)index withDuration:(NSTimeInterval)duration withCompletionBlock:(JMCompletionFinishBlock)finishBlock;
98 |
99 | //Specific to GIF
100 | @property (strong, readonly, nonatomic) JMGif *gifObject;
101 |
102 | /**
103 | * isAGifImageView
104 | *
105 | * @return BOOL
106 | */
107 | - (BOOL)isAGifImageView;
108 |
109 | /**
110 | * reloadAnimationImagesFromGifData:, This method reload a GIF image from a GIF NSData
111 | *
112 | * @param data NSData data
113 | */
114 | - (void)reloadAnimationImagesFromGifData:(NSData *)data;
115 | - (void)reloadAnimationImagesFromGifData:(NSData *)data fromUrl:(NSURL *)url;
116 |
117 | /**
118 | * reloadAnimationImagesFromGifNamed:, This method reload a GIF image from a GIF named
119 | *
120 | * @param gitName NSString gitName
121 | */
122 | - (void)reloadAnimationImagesFromGifNamed:(NSString *)gitName;
123 |
124 | @end
125 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMAnimatedImageView.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMAnimatedImageView.h"
10 | #import "JMAnimationOperation.h"
11 | #import "UIImage+JM.h"
12 | #import "JMAnimatedImageView+Image.h"
13 | #import "JMAnimatedLog.h"
14 | #import "JMGif.h"
15 |
16 | @interface JMAnimatedImageView()
17 | @property (nonatomic, assign) NSInteger operationInQueue;
18 | @property (nonatomic, strong) UIPanGestureRecognizer *panGesture;
19 | @property (nonatomic, strong) UITapGestureRecognizer *tapGesture;
20 |
21 | //Specific to animation type JMAnimatedImageViewAnimationTypeManualSwipe
22 | @property (nonatomic, strong) UIImageView *tempSwapedImageView;
23 | @property (nonatomic, strong) UIPageControl *pageControl;
24 | @end
25 |
26 | @implementation JMAnimatedImageView
27 |
28 | #pragma mark - init
29 |
30 | - (id)initWithFrame:(CGRect)frame
31 | {
32 | self = [super initWithFrame:frame];
33 | if (self) {
34 | [self setup];
35 | }
36 | return self;
37 | }
38 |
39 | - (id)initWithCoder:(NSCoder *)aDecoder
40 | {
41 | self = [super initWithCoder:aDecoder];
42 | if (self) {
43 | [self setup];
44 | }
45 | return self;
46 | }
47 |
48 | - (void)setup
49 | {
50 | self.userInteractionEnabled = YES;
51 | _memoryManagementOption = JMAnimatedImageViewMemoryLoadImageSystemCache;
52 | _animationType = JMAnimatedImageViewAnimationTypeInteractive;
53 | _animationQueue = [NSOperationQueue new];
54 | _animationQueue.name = @"JMAnimatedImageViewAnimationQueue";
55 | _animationQueue.maxConcurrentOperationCount = 1;
56 | _animationManagementQueue = dispatch_queue_create("com.animationManagement.queue", NULL);
57 | _imageOrder = JMAnimatedImageViewOrderNormal;
58 | [self setInteractiveAnimation:NO];
59 | self.clipsToBounds = YES;
60 | }
61 |
62 | - (void)reloadAnimationImages
63 | {
64 | if ([self.animationDatasource respondsToSelector:@selector(firstIndexForAnimatedImageView:)]) {
65 | [self setCurrentIndex:[self.animationDatasource firstIndexForAnimatedImageView:self]];
66 | } else {
67 | [self setCurrentIndex:0];
68 | }
69 | }
70 |
71 | - (void)reloadAnimationImagesFromGifData:(NSData *)data fromUrl:(NSURL *)url
72 | {
73 | _gifObject = [[JMGif alloc] initWithData:data fromURL:url];
74 | self.animationDuration = JMDefaultGifDuration;
75 | [self setCurrentCardImageAtindex:0];
76 | }
77 |
78 | - (void)reloadAnimationImagesFromGifData:(NSData *)data
79 | {
80 | _gifObject = [[JMGif alloc] initWithData:data];
81 | self.animationDuration = JMDefaultGifDuration;
82 | [self setCurrentCardImageAtindex:0];
83 | }
84 |
85 | - (void)reloadAnimationImagesFromGifNamed:(NSString *)gitName
86 | {
87 | _gifObject = [JMGif gifNamed:gitName];
88 | self.animationDuration = JMDefaultGifDuration;
89 | [self setCurrentCardImageAtindex:0];
90 | [self updateGestures];
91 | }
92 |
93 | - (BOOL)checkLifeCycleSanity
94 | {
95 | if (self.superview) {
96 | return YES;
97 | }
98 |
99 | return NO;
100 | }
101 |
102 | - (void)setCurrentIndex:(NSInteger)currentIndex
103 | {
104 | NSInteger realIndex = [self realIndexForComputedIndex:currentIndex];
105 |
106 | _currentIndex = realIndex;
107 | if ([self.animationDelegate respondsToSelector:@selector(imageView:didChangeCurrentindex:)]) {
108 | [self.animationDelegate imageView:self didChangeCurrentindex:_currentIndex];
109 | }
110 |
111 | self.image = [self imageAtIndex:_currentIndex];
112 | if (self.animationType == JMAnimatedImageViewAnimationTypeManualSwipe) {
113 | [self updatePageControl];
114 | }
115 | }
116 |
117 | - (void)setupTempImageViewAtOriginiX:(CGFloat)x
118 | {
119 | [self.tempSwapedImageView removeFromSuperview];
120 | self.tempSwapedImageView = [[UIImageView alloc] initWithFrame:self.bounds];
121 |
122 | CGRect frame = self.tempSwapedImageView.frame;
123 | frame.origin.x = x;
124 | self.tempSwapedImageView.frame = frame;
125 |
126 | self.tempSwapedImageView.contentMode = self.contentMode;
127 |
128 | //add shadow
129 | self.tempSwapedImageView.layer.shadowColor = [[UIColor blackColor] CGColor];
130 | self.tempSwapedImageView.layer.shadowOffset = CGSizeMake(0.0f,0.0f);
131 | self.tempSwapedImageView.layer.shadowOpacity = 0.7f;
132 | self.tempSwapedImageView.layer.shadowRadius = 10.0f;
133 | CGRect shadowRect = CGRectInset(self.tempSwapedImageView.bounds, 0, 4); // inset top/bottom
134 | self.tempSwapedImageView.layer.shadowPath = [[UIBezierPath bezierPathWithRect:shadowRect] CGPath];
135 | [self addSubview:self.tempSwapedImageView];
136 |
137 | if (self.animationType == JMAnimatedImageViewAnimationTypeManualSwipe) {
138 | [self bringSubviewToFront:self.pageControl];
139 | }
140 | }
141 |
142 | #pragma mark - overided setter
143 |
144 | - (BOOL)isAGifImageView
145 | {
146 | if (_gifObject) {
147 | return YES;
148 | }
149 | return NO;
150 | }
151 |
152 | - (void)setInteractiveAnimation:(BOOL)interactiveAnimation
153 | {
154 | _interactiveAnimation = interactiveAnimation;
155 | [self updateGestures];
156 | }
157 |
158 | - (void)setAnimationType:(JMAnimatedImageViewAnimationType)animationType
159 | {
160 | _animationType = animationType;
161 | if (animationType == JMAnimatedImageViewAnimationTypeInteractive) {
162 | [self setInteractiveAnimation:YES];
163 | }
164 | }
165 |
166 | - (UIPageControl *)pageControl
167 | {
168 | if (nil == _pageControl) {
169 | //Max size 30% of the width
170 | CGRect pageControlFrame = CGRectMake(
171 | floorf(0.5 * (CGRectGetWidth(self.frame) - (CGRectGetWidth(self.frame) * 0.3))),
172 | CGRectGetHeight(self.frame) - 30.0f,
173 | floorf(CGRectGetWidth(self.frame) * 0.3),
174 | 30.0f);
175 | _pageControl = [[UIPageControl alloc] initWithFrame:pageControlFrame];
176 | _pageControl.numberOfPages = [self numberOfImages];
177 | _pageControl.currentPage = 0;
178 | [self addSubview:_pageControl];
179 | }
180 |
181 | return _pageControl;
182 | }
183 |
184 | #pragma mark - Gesture management
185 |
186 | - (void)updateGestures
187 | {
188 | if (self.interactiveAnimation == YES) {
189 | if (nil == self.panGesture) {
190 | self.panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(imageViewTouched:)];
191 | [self addGestureRecognizer:self.panGesture];
192 | }
193 | if (nil == self.tapGesture) {
194 | self.tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageViewTouched:)];
195 | [self addGestureRecognizer:self.tapGesture];
196 | }
197 | } else {
198 | if (nil != self.panGesture) {
199 | [self removeGestureRecognizer:self.panGesture];
200 | self.panGesture = nil;
201 | }
202 | if (nil != self.tapGesture) {
203 | [self removeGestureRecognizer:self.tapGesture];
204 | self.tapGesture = nil;
205 | }
206 | }
207 | }
208 |
209 | - (void)imageViewTouchedWithTapGesture:(UITapGestureRecognizer *)gestureRecognizer
210 | {
211 | [self cancelAnimations];
212 | }
213 |
214 | - (void)imageViewTouchedWithFollowingPanGesture:(UIPanGestureRecognizer *)gestureRecognizer
215 | {
216 | CGPoint velocity = [gestureRecognizer velocityInView:self];
217 |
218 | if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
219 | UIImage *img = 0;
220 | if(velocity.x > 0) {
221 | img = [self imageAtIndex:[self realIndexForComputedIndex:self.currentIndex+1]];
222 | [self setupTempImageViewAtOriginiX:-CGRectGetWidth(self.bounds)];
223 |
224 | } else {
225 | img = [self imageAtIndex:[self realIndexForComputedIndex:self.currentIndex-1]];
226 | [self setupTempImageViewAtOriginiX:CGRectGetWidth(self.bounds)];
227 | }
228 |
229 | self.tempSwapedImageView.image = img;
230 |
231 | } else if (gestureRecognizer.state == UIGestureRecognizerStateChanged) {
232 | if(velocity.x > 0) {
233 | CGRect frame = self.tempSwapedImageView.frame;
234 | frame.origin.x = -CGRectGetWidth(frame) + [gestureRecognizer translationInView:self].x;
235 | self.tempSwapedImageView.frame = frame;
236 | } else {
237 | CGRect frame = self.tempSwapedImageView.frame;
238 | frame.origin.x = CGRectGetWidth(frame) + [gestureRecognizer translationInView:self].x;
239 | self.tempSwapedImageView.frame = frame;
240 | }
241 |
242 | } else {
243 | self.userInteractionEnabled = NO;
244 |
245 | //Compute if we need to finish the swip
246 | CGRect inter = CGRectIntersection(self.bounds, self.tempSwapedImageView.frame);
247 | BOOL finishSwipeEvent = NO;
248 | if ((inter.size.width * inter.size.height) > (0.3 * self.bounds.size.height * self.bounds.size.width)) {
249 | finishSwipeEvent = YES;
250 | }
251 |
252 | [UIView animateWithDuration:0.25 animations:^{
253 | if (finishSwipeEvent) {
254 | CGRect frame = self.tempSwapedImageView.frame;
255 | frame.origin.x = 0;
256 | self.tempSwapedImageView.frame = frame;
257 | } else {
258 | if (self.tempSwapedImageView.frame.origin.x > 0) {
259 | CGRect frame = self.tempSwapedImageView.frame;
260 | frame.origin.x = self.bounds.size.width;
261 | self.tempSwapedImageView.frame = frame;
262 | } else {
263 | CGRect frame = self.tempSwapedImageView.frame;
264 | frame.origin.x = -self.bounds.size.width;
265 | self.tempSwapedImageView.frame = frame;
266 | }
267 | }
268 | } completion:^(BOOL finished) {
269 | [self.tempSwapedImageView removeFromSuperview];
270 | self.userInteractionEnabled = YES;
271 | if (finishSwipeEvent) {
272 | if (velocity.x > 0) {
273 | [self setCurrentIndex:[self realIndexForComputedIndex:self.currentIndex + 1]];
274 | } else {
275 | [self setCurrentIndex:[self realIndexForComputedIndex:self.currentIndex -1 ]];
276 | }
277 | }
278 | }];
279 | }
280 | }
281 |
282 | - (void)imageViewTouchedWithPanGesture:(UIPanGestureRecognizer *)gestureRecognizer
283 | {
284 | if (self.animationType == JMAnimatedImageViewAnimationTypeManualSwipe) {
285 | [self imageViewTouchedWithFollowingPanGesture:gestureRecognizer];
286 | return;
287 |
288 | } else if (self.animationType == JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition) {
289 | if (gestureRecognizer.state == UIGestureRecognizerStateEnded) {
290 | [self startAnimating];
291 | return;
292 | }
293 | }
294 |
295 | [self cancelAnimations];
296 | [self stopAnimating];
297 |
298 | CGPoint velocity = [gestureRecognizer velocityInView:self];
299 | NSInteger index = [self currentIndex];
300 |
301 | //compute point unity
302 | NSInteger pointUnity = self.frame.size.width / [self numberOfImages];
303 |
304 | //Compute inerty using velocity
305 | NSInteger shift = fabs(velocity.x) / (16 * [UIScreen mainScreen].scale * pointUnity);
306 |
307 | if(velocity.x > 0) {
308 | [self setCurrentIndex:index+(_imageOrder) * shift];
309 | } else {
310 | [self setCurrentIndex:index-(_imageOrder) * shift];
311 | }
312 |
313 | /*
314 | if(abs(velocity.x) > 100 && (
315 | gestureRecognizer.state == UIGestureRecognizerStateEnded ||
316 | gestureRecognizer.state == UIGestureRecognizerStateCancelled))
317 | {
318 | //compute point unity
319 | NSInteger pointUnity = self.frame.size.width / [self.animationDatasource numberOfImagesForAnimatedImageView:self];
320 |
321 | //Compute inerty using velocity
322 | NSInteger shift = abs(velocity.x) / ([UIScreen mainScreen].scale * pointUnity);
323 | if(velocity.x > 0) {
324 | [self moveCurrentCardImageFromIndex:index+1 shift:shift withDuration:3.0];
325 | NSLog(@"gesture inerty went right");
326 | } else {
327 | [self moveCurrentCardImageFromIndex:index-1 shift:-shift withDuration:3.0];
328 | NSLog(@"gesture inerty went left");
329 | }
330 | }
331 | */
332 | }
333 |
334 | - (void)imageViewTouched:(UIGestureRecognizer *)gestureRecognizer
335 | {
336 | if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
337 | [self imageViewTouchedWithPanGesture:(UIPanGestureRecognizer*)gestureRecognizer];
338 |
339 | } else if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
340 | [self imageViewTouchedWithTapGesture:(UITapGestureRecognizer*)gestureRecognizer];
341 | }
342 | }
343 |
344 | #pragma mark - Load images
345 |
346 | - (void)setCurrentCardImageAtindex:(NSInteger)index
347 | {
348 | NSInteger realIndex = [self realIndexForComputedIndex:index];
349 | self.image = [self imageAtIndex:realIndex];
350 | self.currentIndex = realIndex;
351 |
352 | if (self.animationType == JMAnimatedImageViewAnimationTypeManualSwipe) {
353 | [self updatePageControl];
354 | }
355 | }
356 |
357 | - (void)setCurrentImage:(UIImage *)img forIndex:(NSInteger)index
358 | {
359 | JMLog(@"%s index:%d",__FUNCTION__,(int)index);
360 | NSInteger realIndex = [self realIndexForComputedIndex:index];
361 | self.image = img;
362 | self.currentIndex = realIndex;
363 | if (self.animationType == JMAnimatedImageViewAnimationTypeManualSwipe) {
364 | [self updatePageControl];
365 | }
366 | }
367 |
368 | - (NSInteger)realIndexForComputedIndex:(NSInteger)index
369 | {
370 | NSInteger nb = [self numberOfImages];
371 |
372 | if (index < 0) {
373 | return nb + index;
374 | } else if (index >= nb) {
375 | index = index - nb;
376 | }
377 |
378 | return index;
379 | }
380 |
381 | - (void)updatePageControl
382 | {
383 | self.pageControl.currentPage = self.currentIndex;
384 | }
385 |
386 | - (void)moveCurrentCardImageFromIndex:(NSInteger)fromIndex
387 | shift:(NSInteger)shift
388 | withDuration:(NSTimeInterval)duration
389 | animationOption:(UIImageViewAnimationOption)option
390 | withCompletionBlock:(JMCompletionFinishBlock)finishBlock
391 | {
392 | dispatch_async(self.animationManagementQueue, ^{
393 |
394 | NSTimeInterval unitDuration;
395 | NSInteger shiftUnit = shift / abs((int)shift); // 1 ou -1
396 |
397 | if (duration == JMDefaultGifDuration) {
398 | unitDuration = duration;
399 |
400 | } else {
401 | if (option == UIImageViewAnimationOptionLinear) {
402 | unitDuration = duration / abs((int)shift);
403 | } else {
404 | unitDuration = duration / abs((int)(shift * shift));
405 | }
406 | }
407 |
408 | JMLog(@"%s fromIndex:%d shift:%d duration:%lf",__FUNCTION__,(int)fromIndex,(int)shift,duration);
409 |
410 | //[self cancelAnimations];
411 | [self.animationQueue cancelAllOperations];
412 | [self.animationQueue waitUntilAllOperationsAreFinished];
413 |
414 | //Compute minimal interval to perform an image switch 30hz ..
415 | NSTimeInterval minimumInterval = 1.0/30.0;
416 | NSTimeInterval currentInterval = 0.0;
417 |
418 | for (int i = 0; i < (int)abs((int)shift) ; i++) {
419 |
420 | currentInterval = currentInterval + unitDuration;
421 | if(currentInterval < minimumInterval) {
422 | continue;
423 |
424 | } else {
425 |
426 | NSInteger index = [self realIndexForComputedIndex:fromIndex+i*shiftUnit];
427 | if ([self isAGifImageView]) {
428 | JMGifItem *item = [[self.gifObject items] objectAtIndex:index];
429 | currentInterval = [item delayDuration];
430 | }
431 |
432 | __weak JMAnimatedImageView *weakSelf = self;
433 | JMAnimationOperation *operation = [JMAnimationOperation animationOperationWithDuration:currentInterval
434 | completion:^(BOOL finished)
435 | {
436 |
437 | if (weakSelf.animationType == JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition) {
438 | if ([weakSelf operationQueueIsFinished] == YES) {
439 | if (finishBlock) {
440 | finishBlock(YES);
441 | }
442 |
443 | if (weakSelf.animationRepeatCount == 0 && weakSelf.animationState == UIImageViewAnimationStateInPgrogress) {
444 | [weakSelf continueAnimating];
445 | }
446 | }
447 | }
448 | }];
449 |
450 | operation.animatedImageView = weakSelf;
451 | operation.imageIndex = index;
452 |
453 | currentInterval = 0;
454 | [self.animationQueue addOperation:operation];
455 | }
456 | }
457 | });
458 | }
459 |
460 | - (void)changeImageToIndex:(NSInteger)index withTimeInterval:(NSTimeInterval)duration repeat:(BOOL)repeat
461 | {
462 | if ([self checkLifeCycleSanity] == NO) {
463 | return;
464 | }
465 |
466 | if (duration == -1) {
467 | [self setCurrentIndex:index];
468 | }
469 |
470 | //animation changement
471 | [self setupTempImageViewAtOriginiX:CGRectGetWidth(self.bounds)];
472 |
473 | self.tempSwapedImageView.image = [self imageAtIndex:[self realIndexForComputedIndex:index] ];
474 |
475 | [UIView animateWithDuration:duration animations:^{
476 | CGRect frame = self.tempSwapedImageView.frame;
477 | frame.origin.x = 0.0f;
478 | self.tempSwapedImageView.frame = frame;
479 |
480 | } completion:^(BOOL finished) {
481 | [self.tempSwapedImageView removeFromSuperview];
482 | [self setCurrentIndex:[self realIndexForComputedIndex:index]];
483 | if (repeat) {
484 | [self changeImageToIndex:(self.currentIndex+1) withTimeInterval:duration repeat:repeat];
485 | }
486 | }];
487 | }
488 |
489 | #pragma mark - Manage images automatic animation
490 |
491 | - (void)animateToIndex:(NSInteger)index withDuration:(NSTimeInterval)duration withCompletionBlock:(JMCompletionFinishBlock)finishBlock
492 | {
493 | [self stopAnimating];
494 |
495 | //find minimum shift
496 | [self moveCurrentCardImageFromIndex:self.currentIndex
497 | shift:[self minimalShiftFromIndex:self.currentIndex toIndex:index]
498 | withDuration:duration
499 | animationOption:UIImageViewAnimationOptionLinear
500 | withCompletionBlock:finishBlock];
501 | }
502 |
503 |
504 | - (void)animateToIndex:(NSInteger)index withDuration:(NSTimeInterval)duration
505 | {
506 | [self animateToIndex:index withDuration:duration withCompletionBlock:NULL];
507 | }
508 |
509 | - (NSInteger)minimalShiftFromIndex:(NSInteger)index toIndex:(NSInteger)toIndex
510 | {
511 | //compute decrement
512 | NSInteger nbDecrement = 0;
513 | if (toIndex < index) {
514 | nbDecrement = index - toIndex;
515 | } else {
516 | nbDecrement = index + toIndex;
517 | }
518 |
519 | //compute increment
520 | NSInteger nbIncrement = 0;
521 | if (index < toIndex) {
522 | nbIncrement = toIndex - index;
523 | } else {
524 | nbIncrement = ([self.animationDatasource numberOfImagesForAnimatedImageView:self] - index) + toIndex;
525 | }
526 |
527 | if (nbIncrement < nbDecrement) {
528 | return nbIncrement;
529 | }
530 | return -nbDecrement;
531 | }
532 |
533 |
534 | - (void)setCurrentIndex:(NSInteger)index animated:(BOOL)animated
535 | {
536 | if (animated) {
537 | [self changeImageToIndex:index withTimeInterval:0.25 repeat:NO];
538 | } else {
539 | [self changeImageToIndex:index withTimeInterval:-1 repeat:NO];
540 | }
541 | }
542 |
543 | - (void)setImage:(UIImage *)img forCurrentIndex:(NSInteger)index
544 | {
545 | NSInteger realIndex = [self realIndexForComputedIndex:index];
546 | // dispatch_async(dispatch_get_main_queue(), ^{
547 | self.image = img;
548 | self.currentIndex = realIndex;
549 | // });
550 | }
551 |
552 | - (void)startAnimating
553 | {
554 | _animationState = UIImageViewAnimationStateInPgrogress;
555 |
556 | if ([self checkLifeCycleSanity] == NO) {
557 | return;
558 | }
559 |
560 | if (self.animationType == JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition) {
561 | [self moveCurrentCardImageFromIndex:self.currentIndex
562 | shift:[self numberOfImages]
563 | withDuration:self.animationDuration
564 | animationOption:UIImageViewAnimationOptionLinear
565 | withCompletionBlock:NULL];
566 |
567 | } else if (self.animationType == JMAnimatedImageViewAnimationTypeAutomaticLinear) {
568 | [self changeImageToIndex:(self.currentIndex + 1) withTimeInterval:self.animationDuration repeat:YES];
569 | }
570 | }
571 |
572 | - (void)continueAnimating
573 | {
574 | _animationState = UIImageViewAnimationStateInPgrogress;
575 |
576 | dispatch_async(dispatch_get_main_queue(), ^{
577 | if ([self checkLifeCycleSanity] == NO) {
578 | return;
579 | }
580 |
581 | if ([self operationQueueIsFinished] == NO) {
582 | return;
583 | }
584 |
585 | [self moveCurrentCardImageFromIndex:self.currentIndex
586 | shift:[self numberOfImages]
587 | withDuration:self.animationDuration
588 | animationOption:UIImageViewAnimationOptionLinear
589 | withCompletionBlock:NULL];
590 | });
591 | }
592 |
593 | - (void)stopAnimating
594 | {
595 | _animationState = UIImageViewAnimationStateStopped;
596 | [self cancelAnimations];
597 | }
598 |
599 | - (BOOL)isAnimating
600 | {
601 | return NO;
602 | }
603 |
604 | - (BOOL)operationQueueIsFinished
605 | {
606 | NSArray *opeInProgress = [self.animationQueue valueForKeyPath:@"operations"];
607 | if (opeInProgress.count == 0) {
608 | return YES;
609 | }
610 | return NO;
611 | }
612 |
613 | - (void)cancelAnimations
614 | {
615 | //NSLog(@"Cancel %d operations ", (int)[[self.animationQueue operations] count]);
616 | for (NSOperation* o in [self.animationQueue operations]) {
617 | if ([o isKindOfClass:[o class]]) {
618 | [o cancel];
619 | }
620 | }
621 | }
622 |
623 | @end
624 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedLog.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMAnimatedLog.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 10/09/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #ifndef JMAnimatedImageView_JMAnimatedLog_h
10 | #define JMAnimatedImageView_JMAnimatedLog_h
11 |
12 | // Log using the same parameters above but include the function name and source code line number in the log statement
13 | #ifdef DEBUG
14 | #define JMLog(fmt, ...) NSLog((@"Func: %s, Line: %d, " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
15 | #else
16 | #define JMLog(...)
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMAnimationOperation.h:
--------------------------------------------------------------------------------
1 | //
2 | // AnimationOperation.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef void (^JMCompletionBlock)(BOOL finished);
12 | typedef void (^JMAnimationBlock)(void);
13 |
14 | @class JMAnimatedImageView;
15 | @interface JMAnimationOperation : NSOperation
16 |
17 | @property (copy, nonatomic) JMCompletionBlock animationCompletionBlock;
18 | @property (assign, nonatomic) NSTimeInterval duration;
19 | @property (assign, nonatomic) NSInteger imageIndex;
20 | @property (weak, nonatomic) JMAnimatedImageView *animatedImageView;
21 |
22 | /**
23 | * animationOperationWithDuration:completion: create an animated operation, JMAnimationOperation
24 | *
25 | * @param duration NSTimeInterval duration
26 | * @param completion JMCompletionBlock completionBlock
27 | *
28 | * @return JMAnimationOperation
29 | */
30 | + (instancetype)animationOperationWithDuration:(NSTimeInterval)duration
31 | completion:(JMCompletionBlock)completion;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMAnimationOperation.m:
--------------------------------------------------------------------------------
1 | //
2 | // AnimationOperation.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMAnimationOperation.h"
10 | #import "JMAnimatedImageView.h"
11 | #import "UIImage+JM.h"
12 | #import "JMAnimatedImageView+Image.h"
13 |
14 | #include
15 | #import
16 |
17 | long getMillis()
18 | {
19 | struct timeval time;
20 | gettimeofday(&time, NULL);
21 | long millis = (time.tv_sec * 1000) + (time.tv_usec / 1000);
22 | return millis;
23 | }
24 |
25 | @interface JMAnimationOperation ()
26 | @property (assign, nonatomic) BOOL isCancelled;
27 | @property (assign, nonatomic) BOOL isExecuting;
28 | @property (assign, nonatomic) BOOL isFinished;
29 | @end
30 |
31 | @implementation JMAnimationOperation
32 |
33 | + (instancetype)animationOperationWithDuration:(NSTimeInterval)duration completion:(void (^)(BOOL finished))completion
34 | {
35 | JMAnimationOperation *op = [JMAnimationOperation new];
36 | JMCompletionBlock completionBlock = ^(BOOL finish){
37 | //NSLog(@"Operation is about to finished.");
38 | [op finish];
39 | if (completion) {
40 | completion(finish);
41 | }
42 | };
43 |
44 | op.duration = duration;
45 | op.animationCompletionBlock = completionBlock;
46 | return op;
47 | }
48 |
49 | - (BOOL)isConcurrent
50 | {
51 | return NO;
52 | }
53 |
54 | - (void)start
55 | {
56 | [self willChangeValueForKey:@"isExecuting"];
57 | _isExecuting = YES;
58 | [self didChangeValueForKey:@"isExecuting"];
59 |
60 |
61 | if (_isCancelled == YES)
62 | {
63 | _isFinished = YES;
64 | }
65 | else {
66 |
67 |
68 | long timeStart = getMillis();
69 |
70 | UIImage *image = [self.animatedImageView imageAtIndex:self.imageIndex];
71 |
72 | long timeEnd = getMillis();
73 | long diff = timeEnd - timeStart;
74 | double millisToLoadImage = (diff/1000.0);
75 |
76 | //Compute number of Millis to load an image and fix self.duration
77 | if (millisToLoadImage < self.duration) {
78 | [NSThread sleepForTimeInterval:(self.duration - millisToLoadImage)];
79 | dispatch_async(dispatch_get_main_queue(), ^{
80 | [self.animatedImageView setImage:image forCurrentIndex:self.imageIndex];
81 | self.animationCompletionBlock(YES);
82 | });
83 |
84 | } else {
85 | dispatch_async(dispatch_get_main_queue(), ^{
86 | [self.animatedImageView setImage:image forCurrentIndex:self.imageIndex];
87 | self.animationCompletionBlock(YES);
88 | });
89 | }
90 | }
91 | }
92 |
93 | - (void)finish
94 | {
95 | [self willChangeValueForKey:@"isExecuting"];
96 | [self willChangeValueForKey:@"isFinished"];
97 |
98 | _isExecuting = NO;
99 | _isFinished = YES;
100 |
101 | [self didChangeValueForKey:@"isExecuting"];
102 | [self didChangeValueForKey:@"isFinished"];
103 |
104 | if (_isCancelled == YES)
105 | {
106 | _isFinished = YES;
107 | }
108 | }
109 |
110 | - (void)cancel
111 | {
112 | _isCancelled = YES;
113 | _isFinished = YES;
114 | }
115 |
116 | @end
117 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMGif.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMGif.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 20/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 | @interface JMGif : NSObject
11 |
12 | @property (readonly, nonatomic) NSArray *items; //images + infos
13 | @property (readonly, nonatomic) NSURL *url;
14 |
15 | - (instancetype)initWithData:(NSData *)data;
16 | - (instancetype)initWithData:(NSData *)data fromURL:(NSURL *)url;
17 | + (instancetype)gifNamed:(NSString *)gifName;
18 |
19 | - (UIImage *)imageAtIndex:(NSInteger)index;
20 |
21 | + (BOOL)cleanGifCache;
22 | + (BOOL)cleanGifCacheError:(NSError **)error;
23 | + (BOOL)cleanGifCacheForGifNamed:(NSString *)gifName;
24 | + (BOOL)cleanGifCacheForGifNamed:(NSString *)gifName error:(NSError **)error;
25 | + (void)cacheGifData:(NSData *)data gifAbsoluteUrl:(NSString *)absoluteUrl;
26 |
27 | @end
28 |
29 |
30 |
31 | #define JMGifItemDelayTimeKey @"DelayTime"
32 | #define JMGifItemUnclampedDelayTimeKey @"UnclampedDelayTime"
33 |
34 | @interface JMGifItem : NSObject
35 |
36 | @property (readonly, nonatomic) UIImage *image;
37 | @property (readonly, nonatomic) NSString *imagePath;
38 | @property (readonly, nonatomic) NSTimeInterval delayDuration;
39 |
40 | - (instancetype)initWithImage:(UIImage *)image frameProperties:(NSDictionary *)frameProperties;
41 | - (instancetype)initWithImagePath:(NSString *)imagePath frameProperties:(NSDictionary *)frameProperties;
42 | - (instancetype)initWithImage:(UIImage *)image imagePath:(NSString *)imagePath frameProperties:(NSDictionary *)frameProperties;
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMGif.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMGif.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 20/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMGif.h"
10 | #import "UIImage+JM.h"
11 |
12 | #import
13 | #import
14 | #import
15 | #import "JMAmimatedImageViewMacro.h"
16 |
17 | @interface JMGif ()
18 | @end
19 |
20 | @implementation JMGif
21 |
22 | - (instancetype)initWithData:(NSData *)data gifName:(NSString *)gifName fromURL:(NSURL *)url
23 | {
24 | self = [super init];
25 | if (self) {
26 | if (url.absoluteString.length && data) {
27 | [self.class cacheGifData:data gifAbsoluteUrl:url.absoluteString];
28 | }
29 |
30 | [self loadGifWithData:data gifName:gifName fromURL:url];
31 | }
32 | return self;
33 | }
34 |
35 | - (instancetype)initWithData:(NSData *)data
36 | {
37 | return [self initWithData:data gifName:nil fromURL:nil];
38 | }
39 |
40 | - (instancetype)initWithData:(NSData *)data fromURL:(NSURL *)url
41 | {
42 | return [self initWithData:data gifName:nil fromURL:url];
43 | }
44 |
45 | + (instancetype)gifNamed:(NSString *)gifName
46 | {
47 | NSError *error;
48 | NSURL *url = [[NSBundle mainBundle] URLForResource:gifName withExtension:@"gif"];
49 | NSData *data = [NSData dataWithContentsOfURL:url options:0 error:&error];
50 | if (nil == error) {
51 | JMGif *gif = [[JMGif alloc] initWithData:data gifName:gifName fromURL:nil];
52 | return gif;
53 | }
54 |
55 | return nil;
56 | }
57 |
58 | + (void)cacheGifData:(NSData *)data gifAbsoluteUrl:(NSString *)absoluteUrl
59 | {
60 | CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
61 |
62 | if (!imageSource) {
63 | JMOLog(@"Error: Failed to `CGImageSourceCreateWithData` for animated GIF data %@", data);
64 | return;
65 | }
66 |
67 | // Early return if not GIF!
68 | CFStringRef imageSourceContainerType = CGImageSourceGetType(imageSource);
69 | if (!UTTypeConformsTo(imageSourceContainerType, kUTTypeGIF)) {
70 | JMOLog(@"Error: Supplied data is of type %@ and doesn't seem to be GIF data %@", imageSourceContainerType, data);
71 | CFRelease(imageSource);
72 | return;
73 | }
74 |
75 | // Iterate through frame images
76 | size_t imageCount = CGImageSourceGetCount(imageSource);
77 | for (size_t i = 0; i < imageCount; i++) {
78 | CGImageRef frameImageRef = CGImageSourceCreateImageAtIndex(imageSource, i, NULL);
79 | if (frameImageRef) {
80 | //UIImage *frameImage = [UIImage imageWithCGImage:frameImageRef];
81 | // Check for valid `frameImage` before parsing its properties as frames can be corrupted (and `frameImage` even `nil` when `frameImageRef` was valid).
82 | if (YES) {
83 | NSDictionary *frameProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(imageSource, i, NULL);
84 | NSDictionary *framePropertiesGIF = [frameProperties objectForKey:(id)kCGImagePropertyGIFDictionary];
85 | if (absoluteUrl) {
86 | if ([self gifNamedAlreadyCached:absoluteUrl index:i] == NO) {
87 | [self cacheGifName:absoluteUrl image:[UIImage imageWithCGImage:frameImageRef] representingIndex:i];
88 | }
89 | }
90 | }
91 |
92 | CFRelease(frameImageRef);
93 | }
94 | }
95 | CFRelease(imageSource);
96 | }
97 |
98 | - (void)loadGifWithData:(NSData *)data gifName:(NSString *)gifName fromURL:(NSURL *)url
99 | {
100 | CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
101 |
102 | if (!imageSource) {
103 | JMOLog(@"Error: Failed to `CGImageSourceCreateWithData` for animated GIF data %@", data);
104 | return;
105 | }
106 |
107 | // Early return if not GIF!
108 | CFStringRef imageSourceContainerType = CGImageSourceGetType(imageSource);
109 | if (!UTTypeConformsTo(imageSourceContainerType, kUTTypeGIF)) {
110 | JMOLog(@"Error: Supplied data is of type %@ and doesn't seem to be GIF data %@", imageSourceContainerType, data);
111 | CFRelease(imageSource);
112 | return;
113 | }
114 |
115 | // Get `LoopCount`
116 | // Note: 0 means repeating the animation indefinitely.
117 | // Image properties example:
118 | // {
119 | // FileSize = 314446;
120 | // "{GIF}" = {
121 | // HasGlobalColorMap = 1;
122 | // LoopCount = 0;
123 | // };
124 | // }
125 |
126 | // Iterate through frame images
127 | size_t imageCount = CGImageSourceGetCount(imageSource);
128 | NSMutableArray *items = [NSMutableArray arrayWithCapacity:imageCount];
129 | for (size_t i = 0; i < imageCount; i++) {
130 | CGImageRef frameImageRef = CGImageSourceCreateImageAtIndex(imageSource, i, NULL);
131 | if (frameImageRef) {
132 | //UIImage *frameImage = [UIImage imageWithCGImage:frameImageRef];
133 | // Check for valid `frameImage` before parsing its properties as frames can be corrupted (and `frameImage` even `nil` when `frameImageRef` was valid).
134 | if (YES) {
135 | NSDictionary *frameProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(imageSource, i, NULL);
136 | NSDictionary *framePropertiesGIF = [frameProperties objectForKey:(id)kCGImagePropertyGIFDictionary];
137 | JMGifItem *item;
138 | if (gifName) {
139 | item = [[JMGifItem alloc] initWithImagePath:[self.class imagePathForeGifName:gifName index:i]
140 | frameProperties:framePropertiesGIF];
141 | if ([self.class gifNamedAlreadyCached:gifName index:i] == NO) {
142 | [self.class cacheGifName:gifName image:[UIImage imageWithCGImage:frameImageRef] representingIndex:i];
143 | }
144 |
145 | } else if (url.absoluteString) {
146 | item = [[JMGifItem alloc] initWithImagePath:[self.class imagePathForeGifName:url.absoluteString index:i]
147 | frameProperties:framePropertiesGIF];
148 | if ([self.class gifNamedAlreadyCached:url.absoluteString index:i] == NO) {
149 | [self.class cacheGifName:url.absoluteString image:[UIImage imageWithCGImage:frameImageRef] representingIndex:i];
150 | }
151 |
152 | } else {
153 | JMOLog(@"Loading full UIImage ...");
154 | item = [[JMGifItem alloc] initWithImage:[UIImage imageWithCGImage:frameImageRef] frameProperties:framePropertiesGIF];
155 | }
156 |
157 | [items addObject:item];
158 | }
159 |
160 | CFRelease(frameImageRef);
161 | }
162 | }
163 |
164 | _items = items;
165 | CFRelease(imageSource);
166 | }
167 |
168 | - (UIImage *)imageAtIndex:(NSInteger)index
169 | {
170 | JMGifItem *item = [self.items objectAtIndex:index];
171 | if (item.image) {
172 | return item.image;
173 |
174 | } else if (item.imagePath) {
175 | return [UIImage jm_imagePath:item.imagePath withOption:JMAnimatedImageViewMemoryLoadImageLowMemoryUsage];
176 | }
177 |
178 | return nil;
179 | }
180 |
181 | #pragma mark - Gif cache management
182 |
183 | + (BOOL)gifNamedAlreadyCached:(NSString *)gifName
184 | {
185 | NSString *directoryPath = [NSString stringWithFormat:@"%@/%@",[self cacheDirectoryPath],gifName];
186 |
187 | if ([[NSFileManager defaultManager] fileExistsAtPath:directoryPath]) {
188 | return YES;
189 | }
190 |
191 | return NO;
192 | }
193 |
194 | + (BOOL)gifNamedAlreadyCached:(NSString *)gifName index:(NSInteger)index
195 | {
196 | if ([[NSFileManager defaultManager] fileExistsAtPath:[self imagePathForeGifName:gifName index:index]]) {
197 | return YES;
198 | }
199 |
200 | return NO;
201 | }
202 |
203 | + (NSString *)cacheDirectoryPath
204 | {
205 | NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
206 | NSString *directoryPath = [NSString stringWithFormat:@"%@/%@",cachePath,@"JMAnimatedImageView"];
207 | return directoryPath;
208 | }
209 |
210 | + (BOOL)cleanGifCache
211 | {
212 | NSError *cleanError;
213 | return [[NSFileManager defaultManager] removeItemAtPath:[self cacheDirectoryPath] error:&cleanError];
214 | }
215 |
216 | + (BOOL)cleanGifCacheError:(NSError **)error
217 | {
218 | return [[NSFileManager defaultManager] removeItemAtPath:[self cacheDirectoryPath] error:error];
219 | }
220 |
221 | + (BOOL)cleanGifCacheForGifNamed:(NSString *)gifName
222 | {
223 | NSError *cleanError;
224 | return [self cleanGifCacheForGifNamed:gifName error:&cleanError];
225 | }
226 |
227 | + (BOOL)cleanGifCacheForGifNamed:(NSString *)gifName error:(NSError **)error
228 | {
229 | NSString *directoryPath = [NSString stringWithFormat:@"%@/%@",[self cacheDirectoryPath],gifName];
230 | return [[NSFileManager defaultManager] removeItemAtPath:directoryPath error:error];
231 | }
232 |
233 | + (NSString *)imagePathForeGifName:(NSString *)gifName index:(NSInteger)index
234 | {
235 | NSString *directoryPath = [NSString stringWithFormat:@"%@/%@",[self cacheDirectoryPath],gifName];
236 | NSString *filePath = [NSString stringWithFormat:@"%@/%ld.png",directoryPath,(long)index];
237 | return filePath;
238 | }
239 |
240 | + (void)cacheGifName:(NSString *)gifName image:(UIImage *)img representingIndex:(NSInteger)index
241 | {
242 | NSString *directoryPath = [NSString stringWithFormat:@"%@/%@",[self cacheDirectoryPath],gifName];
243 |
244 | BOOL isDirectory = NO;
245 | if (! [[NSFileManager defaultManager] fileExistsAtPath:directoryPath isDirectory:&isDirectory]) {
246 |
247 | NSError *error;
248 | [[NSFileManager defaultManager] createDirectoryAtURL:[NSURL fileURLWithPath:directoryPath]
249 | withIntermediateDirectories:YES
250 | attributes:nil
251 | error:&error];
252 | }
253 |
254 | NSData *data = UIImagePNGRepresentation(img);
255 | if (data) {
256 | NSString *imgPath = [self imagePathForeGifName:gifName index:index];
257 | NSError *writeError;
258 | [data writeToFile:imgPath options:0 error:&writeError];
259 | }
260 | }
261 |
262 | @end
263 |
264 |
265 | @interface JMGifItem ()
266 | @property (readonly, nonatomic) NSDictionary *delay;
267 | @end
268 |
269 | @implementation JMGifItem
270 |
271 | - (NSTimeInterval)delayDuration
272 | {
273 | NSNumber *delay = [_delay objectForKey:JMGifItemUnclampedDelayTimeKey];
274 | if (nil == delay) {
275 | delay = [_delay objectForKey:JMGifItemDelayTimeKey];
276 | }
277 |
278 | NSTimeInterval valueToReturn = [delay doubleValue];
279 | if (valueToReturn < 0.011f) {
280 | // a duration of <= 10 ms. See and
281 | // for more information.
282 | valueToReturn = 0.100f;
283 | }
284 |
285 | return valueToReturn;
286 | }
287 |
288 | - (instancetype)initWithImage:(UIImage *)image frameProperties:(NSDictionary *)frameProperties
289 | {
290 | return [self initWithImage:image imagePath:nil frameProperties:frameProperties];
291 | }
292 |
293 | - (instancetype)initWithImagePath:(NSString *)imagePath frameProperties:(NSDictionary *)frameProperties
294 | {
295 | return [self initWithImage:nil imagePath:imagePath frameProperties:frameProperties];
296 | }
297 |
298 | - (instancetype)initWithImage:(UIImage *)image imagePath:(NSString *)imagePath frameProperties:(NSDictionary *)frameProperties
299 | {
300 | self = [super init];
301 | if (self) {
302 | _image = image;
303 | // Get `DelayTime`
304 | // Note: It's not in (1/100) of a second like still falsly described in the documentation as per iOS 7 but in seconds stored as `kCFNumberFloat32Type`.
305 | // Frame properties example:
306 | // {
307 | // ColorModel = RGB;
308 | // Depth = 8;
309 | // PixelHeight = 960;
310 | // PixelWidth = 640;
311 | // "{GIF}" = {
312 | // DelayTime = "0.4";
313 | // UnclampedDelayTime = "0.4";
314 | // };
315 | // }
316 | _delay = frameProperties;
317 | _imagePath = imagePath;
318 |
319 | //dont keep UIImage because we can get it from the _imagePath
320 | if (_imagePath) {
321 | _image = nil;
322 | }
323 | }
324 | return self;
325 | }
326 |
327 | @end
328 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMOImageViewAnimationDatasource.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMOImageViewAnimationDatasource.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol JMOImageViewAnimationDatasource
12 |
13 | - (NSInteger)numberOfImagesForAnimatedImageView:(UIImageView *)imageView;
14 | - (NSString *)imageNameAtIndex:(NSInteger)index forAnimatedImageView:(UIImageView *)imageView;
15 |
16 | @optional
17 | - (NSInteger)firstIndexForAnimatedImageView:(UIImageView *)imageView;
18 | - (UIImage *)imageAtIndex:(NSInteger)index forAnimatedImageView:(UIImageView *)imageView;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/JMOImageViewAnimationDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMOImageViewAnimationDelegate.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol JMOImageViewAnimationDelegate
12 |
13 | @optional
14 | - (void)imageView:(UIImageView *)imageView didEndDraggingWithVelocity:(CGPoint)velocity targetIndex:(inout NSInteger *)targetIndex;
15 | - (void)imageView:(UIImageView *)imageView didChangeCurrentindex:(NSInteger)index;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/UIImage+JM.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+JM.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "JMAnimatedImageView.h"
11 |
12 | @interface UIImage (JM)
13 |
14 | /**
15 | * jm_imageNamed:, This method return an UIImage for a imageName, using default system cache
16 | *
17 | * @param name NSString, image name
18 | *
19 | * @return UIImage
20 | */
21 | + (UIImage *)jm_imageNamed:(NSString *)name;
22 |
23 | /**
24 | * jm_imageNamed:withOption:, This method return an UIImage for a imageName, using a specific MemoryOption
25 | *
26 | * @param name NSString, image name
27 | * @param option JMAnimatedImageViewMemoryOption option
28 | *
29 | * @return UIImage
30 | */
31 | + (UIImage *)jm_imageNamed:(NSString *)name withOption:(JMAnimatedImageViewMemoryOption)option;
32 |
33 | /**
34 | * jm_imagePath:withOption:, This method return an UIImage for a imagePath, using a specific MemoryOption
35 | *
36 | * @param imagePath NSString, image path
37 | * @param option JMAnimatedImageViewMemoryOption option
38 | *
39 | * @return UIImage
40 | */
41 | + (UIImage *)jm_imagePath:(NSString *)imagePath withOption:(JMAnimatedImageViewMemoryOption)option;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAnimatedImageView/UIImage+JM.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+JM.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "UIImage+JM.h"
10 |
11 | @implementation UIImage (JM)
12 |
13 | + (UIImage *)jm_imageNamed:(NSString *)name
14 | {
15 | if (nil == name) {
16 | return nil;
17 | }
18 | return [self jm_imageNamed:name withOption:JMAnimatedImageViewMemoryLoadImageSystemCache];
19 | }
20 |
21 | + (UIImage *)jm_imageNamed:(NSString *)name withOption:(JMAnimatedImageViewMemoryOption)option
22 | {
23 | if (nil == name) {
24 | return nil;
25 | }
26 |
27 | if (option == JMAnimatedImageViewMemoryLoadImageSystemCache) {
28 | return [UIImage imageNamed:name];
29 |
30 | } else {
31 | NSString *extension = [name pathExtension];
32 | NSString *nameWithoutExtension = [name stringByDeletingPathExtension];
33 |
34 | NSString *filePath = [[NSBundle mainBundle] pathForResource:nameWithoutExtension ofType:extension];
35 | return [UIImage imageWithContentsOfFile:filePath];
36 | }
37 | }
38 |
39 | + (UIImage *)jm_imagePath:(NSString *)imagePath withOption:(JMAnimatedImageViewMemoryOption)option
40 | {
41 | return [UIImage imageWithContentsOfFile:imagePath];
42 | }
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMAppDelegate.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "JMRamViewController.h"
11 |
12 | @interface JMAppDelegate : UIResponder
13 |
14 | @property (strong, nonatomic) UIWindow *window;
15 | @property (strong, nonatomic) JMRamViewController* ramVc;
16 |
17 | - (void)loadMemoryFollower;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMAppDelegate.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMAppDelegate.h"
10 |
11 | @interface JMAppDelegate ()
12 | @end
13 |
14 | @implementation JMAppDelegate
15 |
16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17 | {
18 | // Override point for customization after application launch.
19 | return YES;
20 | }
21 |
22 | - (void)applicationWillResignActive:(UIApplication *)application
23 | {
24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26 | }
27 |
28 | - (void)applicationDidEnterBackground:(UIApplication *)application
29 | {
30 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
31 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
32 | }
33 |
34 | - (void)applicationWillEnterForeground:(UIApplication *)application
35 | {
36 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
37 | }
38 |
39 | - (void)applicationDidBecomeActive:(UIApplication *)application
40 | {
41 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
42 | }
43 |
44 | - (void)applicationWillTerminate:(UIApplication *)application
45 | {
46 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
47 | }
48 |
49 | - (void)loadMemoryFollower
50 | {
51 | if (self.ramVc == nil) {
52 | self.ramVc = [JMRamViewController new];
53 | [self.window addSubview:self.ramVc.view];
54 | [self.ramVc startRefreshingMemoryUsage];
55 | }
56 | }
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMFLViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMFLViewController.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 21/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "JMAnimatedImageView.h"
11 | #import "JMTableViewController.h"
12 |
13 | @interface JMFLViewController : UIViewController
14 |
15 | @property (assign, nonatomic) JMDemoType demoExemple;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMFLViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMFLViewController.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 21/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMFLViewController.h"
10 | #import "JMAnimatedImageView.h"
11 |
12 | @interface JMFLViewController ()
13 | @property (weak, nonatomic) IBOutlet JMAnimatedImageView *carImageView1;
14 | @property (weak, nonatomic) IBOutlet JMAnimatedImageView *carImageView2;
15 | @property (weak, nonatomic) IBOutlet JMAnimatedImageView *carImageView3;
16 | @end
17 |
18 | @implementation JMFLViewController
19 |
20 | - (void)viewDidLoad
21 | {
22 | [super viewDidLoad];
23 | // Do any additional setup after loading the view from its nib.
24 |
25 | self.title = @"3 GIF, 3 animations ...";
26 |
27 | self.carImageView1.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
28 | [self.carImageView1 reloadAnimationImagesFromGifNamed:@"rock"];
29 |
30 | self.carImageView2.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
31 | [self.carImageView2 reloadAnimationImagesFromGifNamed:@"Rotating_earth"];
32 |
33 | self.carImageView3.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
34 | [self.carImageView3 reloadAnimationImagesFromGifNamed:@"nyan"];
35 |
36 | if (self.demoExemple & JMDemoInteractive) {
37 | self.carImageView1.animationType = JMAnimatedImageViewAnimationTypeInteractive;
38 | self.carImageView2.animationType = JMAnimatedImageViewAnimationTypeInteractive;
39 | self.carImageView3.animationType = JMAnimatedImageViewAnimationTypeInteractive;
40 | [self.carImageView1 setInteractiveAnimation:YES];
41 | [self.carImageView2 setInteractiveAnimation:YES];
42 | [self.carImageView3 setInteractiveAnimation:YES];
43 |
44 | } else {
45 | self.carImageView1.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
46 | self.carImageView2.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
47 | self.carImageView3.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
48 | [self.carImageView1 setInteractiveAnimation:NO];
49 | [self.carImageView2 setInteractiveAnimation:NO];
50 | [self.carImageView3 setInteractiveAnimation:NO];
51 |
52 | self.carImageView1.animationDuration = 3;
53 | self.carImageView2.animationDuration = 3;
54 | self.carImageView3.animationDuration = 3;
55 |
56 | [self.carImageView1 startAnimating];
57 | [self.carImageView2 startAnimating];
58 | [self.carImageView3 startAnimating];
59 | }
60 | }
61 |
62 | - (void)viewDidAppear:(BOOL)animated
63 | {
64 | [super viewDidAppear:animated];
65 | JMAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
66 | [appDelegate.ramVc.view removeFromSuperview];
67 |
68 | [self.view addSubview:appDelegate.ramVc.view];
69 | [appDelegate.ramVc startRefreshingMemoryUsage];
70 | }
71 |
72 | @end
73 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMFLViewController.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMRamViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMRamViewController.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 22/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface JMRamViewController : UIViewController
12 |
13 | - (void)startRefreshingMemoryUsage;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMRamViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMRamViewController.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 22/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMRamViewController.h"
10 | #import "AppInformationsManager.h"
11 | #import "mach/mach.h"
12 |
13 | @interface JMRamViewController ()
14 | @property (weak, nonatomic) IBOutlet UILabel *memoryLabel;
15 | @property (strong, nonatomic) NSTimer *timer;
16 | @property (assign, nonatomic) CGFloat initailFreeMemorySpaceMo;
17 | @end
18 |
19 | @implementation JMRamViewController
20 |
21 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
22 | {
23 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
24 | if (self) {
25 | // Custom initialization
26 | //_initailFreeMemorySpaceMo = [self getUsedMemory];
27 | }
28 | return self;
29 | }
30 |
31 | - (void)viewDidLoad
32 | {
33 | [super viewDidLoad];
34 | // Do any additional setup after loading the view from its nib.
35 | }
36 |
37 | - (void)didReceiveMemoryWarning
38 | {
39 | [super didReceiveMemoryWarning];
40 | // Dispose of any resources that can be recreated.
41 | }
42 |
43 | #pragma mark -
44 |
45 | - (void)refreshMemoryUsage
46 | {
47 | self.memoryLabel.text = [NSString stringWithFormat:@"%2.f MO",[self getUsedMemory]];
48 | }
49 |
50 | - (CGFloat)getUsedMemory
51 | {
52 | struct task_basic_info info;
53 | mach_msg_type_number_t size = sizeof(info);
54 | kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t) &info, &size);
55 | if (kerr == KERN_SUCCESS) {
56 | CGFloat freeMemorySpaceMo = info.resident_size / (1024 * 1024);
57 | return freeMemorySpaceMo;
58 | }
59 |
60 | return -1.0f;
61 |
62 | }
63 |
64 | - (void)startRefreshingMemoryUsage
65 | {
66 | self.timer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(refreshMemoryUsage) userInfo:nil repeats:YES];
67 | [self.timer fire];
68 | }
69 |
70 | @end
71 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMRamViewController.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
29 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMTableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMTableViewCell.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface JMTableViewCell : UITableViewCell
12 |
13 | @property (weak, nonatomic) IBOutlet UILabel *jmLabel;
14 | @property (weak, nonatomic) IBOutlet UILabel *jmDetailsLabel;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMTableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMTableViewCell.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMTableViewCell.h"
10 |
11 | @implementation JMTableViewCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (void)awakeFromNib
23 | {
24 | // Initialization code
25 | }
26 |
27 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
28 | {
29 | [super setSelected:selected animated:animated];
30 |
31 | // Configure the view for the selected state
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMTableViewController.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_OPTIONS(NSUInteger, JMDemoType) {
12 | JMDemoAutomatic = 1,
13 | JMDemoInteractive = 1 << 1,
14 | JMDemoChangeImageSwipeTransition = 1 << 2,
15 | JMDemoChangeImageNoTransition = 1 << 3,
16 | JMDemoMemoryBySystem = 1 << 4,
17 | JMDemoMemoryByMyComponent = 1 << 5,
18 | JMDemoReverseImage = 1 << 6,
19 | JMDemoPhotos = 1 << 8
20 | };
21 |
22 | @interface JMTableViewController : UITableViewController
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMTableViewController.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMTableViewController.h"
10 | #import "JMViewController.h"
11 | #import "JMTableViewCell.h"
12 | #import "JMFLViewController.h"
13 | #import "JMAppDelegate.h"
14 |
15 | @interface JMTableViewController ()
16 |
17 | @end
18 |
19 | @implementation JMTableViewController
20 |
21 | - (void)viewDidLoad
22 | {
23 | [super viewDidLoad];
24 |
25 | // Uncomment the following line to preserve selection between presentations.
26 | // self.clearsSelectionOnViewWillAppear = NO;
27 |
28 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
29 | // self.navigationItem.rightBarButtonItem = self.editButtonItem;
30 |
31 | self.title = @"JMAnimatedImageView demos";
32 | JMAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
33 | [appDelegate loadMemoryFollower];
34 | }
35 |
36 | - (void)viewDidAppear:(BOOL)animated
37 | {
38 | [super viewDidAppear:animated];
39 | JMAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
40 | [appDelegate.ramVc.view removeFromSuperview];
41 | [self.view addSubview:appDelegate.ramVc.view];
42 | [appDelegate.ramVc startRefreshingMemoryUsage];
43 |
44 | CGRect rect = appDelegate.ramVc.view.frame;
45 | rect.origin.x = 800;
46 | appDelegate.ramVc.view.frame = rect;
47 | }
48 |
49 | #pragma mark - Table view data source
50 |
51 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
52 | {
53 | return 7;
54 | }
55 |
56 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
57 | {
58 | JMTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"JMTableViewCell" forIndexPath:indexPath];
59 |
60 | switch (indexPath.row) {
61 | case 0:
62 | cell.jmLabel.text = @"PNG + Automatic Transition + system cache";
63 | cell.jmDetailsLabel.text = @"All images are loaded in one time in memory (so ... it's take a lot of time to run the 1st time).";
64 | break;
65 |
66 | case 1:
67 | cell.jmLabel.text = @"PNG + Automatic Transition + system cache";
68 | cell.jmDetailsLabel.text = @"Images are loaded during the animation.";
69 | break;
70 |
71 | case 2:
72 | cell.jmLabel.text = @"PNG + Automatic Transition + JMAnimatedImageView cache";
73 | cell.jmDetailsLabel.text = @"More CPU time to load / reload images but less memory used.";
74 | break;
75 |
76 | case 3:
77 | cell.jmLabel.text = @"PNG + Interactive Transition + JMAnimatedImageView cache";
78 | cell.jmDetailsLabel.text = @"Swipe left / Right to manage the animation.";
79 | break;
80 |
81 | case 4:
82 | cell.jmLabel.text = @"PNG + Carousel Transition + JMAnimatedImageView cache";
83 | cell.jmDetailsLabel.text = @"Swipe left / Right to swipe";
84 | break;
85 |
86 | case 5:
87 | cell.jmLabel.text = @"GIF + Automatic Transition + JMAnimatedImageView cache";
88 | cell.jmDetailsLabel.text = @"Swipe left / Right";
89 | break;
90 |
91 | case 6:
92 | cell.jmLabel.text = @"GIF + Interactive Transition + JMAnimatedImageView cache";
93 | cell.jmDetailsLabel.text = @"Swipe left / Right";
94 | break;
95 |
96 | default:
97 | break;
98 | }
99 | return cell;
100 | }
101 |
102 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
103 | {
104 | UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
105 |
106 | JMDemoType demoType = 0;
107 | switch (indexPath.row) {
108 | case 0:
109 | demoType = ( JMDemoAutomatic | JMDemoMemoryBySystem | JMDemoChangeImageNoTransition);
110 | break;
111 |
112 | case 1:
113 | demoType = ( JMDemoAutomatic | JMDemoMemoryBySystem | JMDemoChangeImageNoTransition);
114 | break;
115 |
116 | case 2:
117 | demoType = ( JMDemoAutomatic | JMDemoMemoryByMyComponent | JMDemoChangeImageNoTransition);
118 | break;
119 |
120 | case 3:
121 | demoType = ( JMDemoInteractive | JMDemoMemoryByMyComponent | JMDemoChangeImageNoTransition | JMDemoReverseImage);
122 | break;
123 |
124 | case 4:
125 | demoType = ( JMDemoInteractive | JMDemoMemoryByMyComponent | JMDemoChangeImageSwipeTransition | JMDemoPhotos);
126 | break;
127 |
128 | case 5:
129 | demoType = ( JMDemoAutomatic | JMDemoMemoryByMyComponent | JMDemoChangeImageNoTransition);
130 | break;
131 |
132 | case 6:
133 | demoType = ( JMDemoInteractive | JMDemoMemoryByMyComponent | JMDemoChangeImageNoTransition);
134 | break;
135 |
136 | default:
137 | break;
138 | }
139 |
140 | if (indexPath.row > 4) {
141 | JMFLViewController *vc = [JMFLViewController new];
142 | UIViewController *vcToPush = vc;
143 | vc.demoExemple = demoType;
144 | [self.navigationController pushViewController:vcToPush animated:YES];
145 |
146 | } else {
147 | JMViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"JMViewController"];
148 | UIViewController *vcToPush = vc;
149 | vc.demoExemple = demoType;
150 | [self.navigationController pushViewController:vcToPush animated:YES];
151 | }
152 | }
153 |
154 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
155 | {
156 | return 60.0f;
157 | }
158 |
159 | @end
160 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMViewController.h
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "JMAnimatedImageView.h"
11 | #import "JMTableViewController.h"
12 |
13 | @interface JMViewController : UIViewController
14 |
15 | @property (assign, nonatomic) JMDemoType demoExemple;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/JMViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMViewController.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import "JMViewController.h"
10 | #import "JMAnimatedImageView.h"
11 | #import "JMAnimatedGifImageView.h"
12 |
13 | @interface JMViewController ()
14 | @property (weak, nonatomic) IBOutlet JMAnimatedImageView *carImageView;
15 | @property (weak, nonatomic) IBOutlet UIImageView *imageView;
16 | @property (assign, nonatomic) JMAnimatedImageViewAnimationType animationType;
17 | @end
18 |
19 | @implementation JMViewController
20 |
21 |
22 | - (void)viewDidLoad
23 | {
24 | [super viewDidLoad];
25 | // Do any additional setup after loading the view, typically from a nib.
26 |
27 | if (self.demoExemple & JMDemoAutomatic) {
28 | if (self.demoExemple & JMDemoChangeImageSwipeTransition) {
29 | self.carImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinear;
30 |
31 | } else {
32 | self.carImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
33 | }
34 |
35 | }
36 |
37 | if (self.demoExemple & JMDemoInteractive) {
38 | self.carImageView.animationType = JMAnimatedImageViewAnimationTypeInteractive;
39 |
40 | if (self.demoExemple & JMDemoChangeImageSwipeTransition) {
41 | self.carImageView.animationType = JMAnimatedImageViewAnimationTypeManualSwipe;
42 | }
43 | }
44 |
45 | if (self.demoExemple & JMDemoMemoryBySystem) {
46 | self.carImageView.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageSystemCache;
47 |
48 | } else {
49 | self.carImageView.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
50 |
51 | }
52 |
53 | if (self.demoExemple & JMDemoReverseImage) {
54 | self.carImageView.imageOrder = JMAnimatedImageViewOrderReverse;
55 | }
56 |
57 | self.imageView.hidden = YES;
58 | self.carImageView.hidden = NO;
59 | self.carImageView.animationDelegate = self;
60 | self.carImageView.animationDatasource = self;
61 | self.carImageView.animationRepeatCount = 0;
62 | self.carImageView.animationDuration = 4.0;
63 |
64 | if (self.demoExemple & JMDemoAutomatic) {
65 | [self.carImageView startAnimating];
66 | } else {
67 | [self.carImageView setCurrentIndex:0 animated:NO];
68 | }
69 | }
70 |
71 | #pragma mark - JMOImageViewAnimationDatasource
72 |
73 | - (NSInteger)numberOfImagesForAnimatedImageView:(UIImageView *)imageView
74 | {
75 | if (self.demoExemple & JMDemoPhotos) {
76 | return 11;
77 | }
78 | return 70;
79 | }
80 |
81 | - (NSString *)imageNameAtIndex:(NSInteger)index forAnimatedImageView:(UIImageView *)imageView
82 | {
83 | if (self.demoExemple & JMDemoPhotos) {
84 | return [NSString stringWithFormat:@"%d_verge_super_wide.jpg",(int)index];
85 | }
86 |
87 | return [NSString stringWithFormat:@"zoom_1920_%d.jpg",(int)index];
88 | }
89 |
90 | - (NSInteger)firstIndexForAnimatedImageView:(UIImageView *)imageView
91 | {
92 | if (self.demoExemple & JMDemoPhotos) {
93 | return 0;
94 | }
95 |
96 | return 0;
97 | }
98 |
99 | - (void)dealloc
100 | {
101 | [self.carImageView stopAnimating];
102 | }
103 |
104 | - (void)viewDidAppear:(BOOL)animated
105 | {
106 | [super viewDidAppear:animated];
107 | JMAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
108 | [appDelegate.ramVc.view removeFromSuperview];
109 |
110 | [self.view addSubview:appDelegate.ramVc.view];
111 | [appDelegate.ramVc startRefreshingMemoryUsage];
112 | }
113 |
114 | @end
115 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/AppInformationsManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppInformationsManager.h
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "UIDevice+iAppInfos.h"
12 | #import "JMOMobileProvisionning.h"
13 |
14 | #define AppVersionManagerKeyTargetedVersion @"targetedVersion"
15 | #define AppVersionManagerKeyYouriOSVersion @"currentOSVersion"
16 | #define AppVersionManagerKeyCFBundleVersion @"appVersion"
17 | #define AppVersionManagerKeyCFBundleShortVersionString @"shortAppVersion"
18 | #define AppVersionManagerKeyFreeMemory @"freeMemorySpace"
19 | #define AppVersionManagerKeyOperator @"operatorName"
20 | #define AppVersionManagerKeyYourDeviceModel @"deviceModelName"
21 | #define AppVersionManagerKeyYourDeviceType @"deviceModelType"
22 | #define AppVersionManagerKeyGraphicalPerformance @"devicePowerInfo"
23 | #define AppVersionManagerKeyCompilationSDK @"compilationSDK"
24 | #define AppVersionManagerKeyFreeDiskSpace @"freeDiskSpace"
25 | #define AppVersionManagerKeyBatteryLevel @"batteryLevel"
26 | #define AppVersionManagerKeyMobileProvisionning @"mobileProvisionning"
27 |
28 | #define AppVersionManagerKeyWSConfiguration @"WSConfiguration" //From Datasource
29 | #define AppVersionManagerKeyPushToken @"PushToken" //From Datasource
30 |
31 | @interface AppInformationsManager : NSObject
32 |
33 | @property (strong, readonly, nonatomic) NSString *targetedVersion;
34 | @property (strong, readonly, nonatomic) NSString *currentOSVersion;
35 | @property (strong, readonly, nonatomic) NSString *appVersion;
36 | @property (strong, readonly, nonatomic) NSString *shortAppVersion;
37 | @property (assign, readonly, nonatomic) NSInteger freeMemorySpace; //in pourcent
38 | @property (strong, readonly, nonatomic) NSString *operatorName;
39 | @property (strong, readonly, nonatomic) NSString *deviceModelName;
40 | @property (assign, readonly, nonatomic) UIDeviceModelType deviceModelType;
41 | @property (strong, readonly, nonatomic) JMODevicePowerInfos *devicePowerInfo;
42 | @property (strong, readonly, nonatomic) NSString *compilationSDK;
43 | @property (strong, readonly, nonatomic) NSString *freeDiskSpace;
44 | @property (assign, readonly, nonatomic) NSInteger batteryLevel; //in pourcent
45 | @property (strong, readonly, nonatomic) JMOMobileProvisionning *mobileProvisionning;
46 |
47 | @property (strong, nonatomic) NSArray *filteredKeys;
48 |
49 |
50 | + (instancetype)sharedManager;
51 | - (void)addCustomValue:(NSString *)value forCustomKey:(NSString *)key;
52 | - (id)infoForKey:(NSString *)key;
53 | - (NSString *)htmlDescriptionWithKeys:(NSArray *)keys;
54 |
55 | @end
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/AppInformationsManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppInformationsManager.m
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import "AppInformationsManager.h"
10 |
11 | #import "UIApplication+iAppInfos.h"
12 | #import "NSDictionary+iAppInfos.h"
13 | #import "JMODevicePowerInfos.h"
14 |
15 | #import "mach/mach.h"
16 | #import
17 | #import
18 |
19 | @interface AppInformationsManager ()
20 | @property (strong, nonatomic) NSMutableDictionary *customValues;
21 | @end
22 |
23 | @implementation AppInformationsManager
24 |
25 | #define MB (1024*1024)
26 | #define GB (MB*1024)
27 |
28 | #pragma mark Singleton Methods
29 |
30 | + (instancetype)sharedManager
31 | {
32 | static AppInformationsManager *sharedMyManager = nil;
33 | static dispatch_once_t onceToken;
34 | dispatch_once(&onceToken, ^{
35 | sharedMyManager = [[self alloc] init];
36 | });
37 | return sharedMyManager;
38 | }
39 |
40 | - (instancetype)init
41 | {
42 | self = [super init];
43 | if (self) {
44 | _customValues = [NSMutableDictionary new];
45 | }
46 | return self;
47 | }
48 |
49 | - (NSString *)description
50 | {
51 | NSArray *keys = [self filteredKeys];
52 | NSMutableString *str = [NSMutableString new];
53 | [str appendString:@"\n"];
54 |
55 | JMOMobileProvisionning *mobileProvi = nil;
56 | [str appendFormat:@"\n\t#Global infos\n"];
57 | for (NSString *key in keys) {
58 | id info = [[AppInformationsManager sharedManager] infoForKey:key];
59 | if ([key isEqualToString:AppVersionManagerKeyMobileProvisionning]) {
60 | mobileProvi = (JMOMobileProvisionning *)info;
61 | }
62 | else {
63 | [str appendFormat:@"\t\t%@\t%@\n", key, info];
64 | }
65 | }
66 |
67 | if (nil != mobileProvi) {
68 | [str appendFormat:@"\n\t#MobileProvisionning infos\n"];
69 | [str appendFormat:@"\t\t%@\n", mobileProvi.teamName ];
70 | [str appendFormat:@"\t\t%@\n", mobileProvi];
71 | }
72 |
73 | return str;
74 | }
75 |
76 | #pragma overrided getters
77 |
78 | - (NSString *)targetedVersion
79 | {
80 | return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleInfoDictionaryVersion"];
81 | }
82 |
83 | - (NSString *)currentOSVersion
84 | {
85 | return [UIDevice currentDevice].systemVersion;
86 | }
87 |
88 | - (NSString *)appVersion
89 | {
90 | return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
91 | }
92 |
93 | - (NSString *)shortAppVersion
94 | {
95 | return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
96 | }
97 |
98 | - (NSInteger)freeMemorySpace
99 | {
100 | unsigned long freeSpace = machFreeMemory();
101 | unsigned long long totalMemory = [[NSProcessInfo processInfo] physicalMemory];
102 | CGFloat pourcent = (CGFloat)freeSpace/totalMemory;
103 | return (NSInteger)(100*pourcent);
104 | }
105 |
106 | - (NSString *)operatorName
107 | {
108 | CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
109 | CTCarrier *carrier = [netinfo subscriberCellularProvider];
110 | return [carrier carrierName];
111 | }
112 |
113 | - (NSString *)deviceModelName
114 | {
115 | return [UIDevice jmo_modelName];
116 | }
117 |
118 | - (UIDeviceModelType)deviceModelType
119 | {
120 | return [UIDevice jmo_deviceModelType];
121 | }
122 |
123 | - (JMODevicePowerInfos *)devicePowerInfo
124 | {
125 | return [UIDevice jmo_devicePowerInfos];
126 | }
127 |
128 | - (NSString *)compilationSDK
129 | {
130 | return [UIApplication jmo_iOSSDKVersion];
131 | }
132 |
133 | - (NSString *)freeDiskSpace
134 | {
135 | long long freeSpace = [[[[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil] objectForKey:NSFileSystemFreeSize] longLongValue];
136 | return [self.class memoryFormatter:freeSpace];
137 | }
138 |
139 | - (NSInteger)batteryLevel
140 | {
141 | [UIDevice currentDevice].batteryMonitoringEnabled = YES;
142 | return (NSInteger)([UIDevice currentDevice].batteryLevel * 100.0f);
143 | }
144 |
145 | - (JMOMobileProvisionning *)mobileProvisionning
146 | {
147 | NSDictionary *dict = [NSDictionary jmo_dictionaryWithDefaultMobileProvisioning];
148 | if (nil == dict) {
149 | return nil;
150 | }
151 |
152 | JMOMobileProvisionning *provisionningObj = [[JMOMobileProvisionning alloc] initWithDictionary:dict];
153 | return provisionningObj;
154 | }
155 |
156 | - (NSArray *)filteredKeys
157 | {
158 | if (nil == _filteredKeys) {
159 | return @[AppVersionManagerKeyTargetedVersion,AppVersionManagerKeyYouriOSVersion,AppVersionManagerKeyYourDeviceModel,AppVersionManagerKeyCompilationSDK, AppVersionManagerKeyCFBundleVersion, AppVersionManagerKeyCFBundleShortVersionString, AppVersionManagerKeyFreeDiskSpace,AppVersionManagerKeyFreeMemory, AppVersionManagerKeyBatteryLevel,AppVersionManagerKeyMobileProvisionning, AppVersionManagerKeyPushToken,AppVersionManagerKeyWSConfiguration];
160 | }
161 | return _filteredKeys;
162 | }
163 |
164 | #pragma mark - Private methods
165 | #pragma mark *memory
166 |
167 | + (NSString *)memoryFormatter:(long long)diskSpace {
168 | NSString *formatted;
169 | double bytes = 1.0 * diskSpace;
170 | double megabytes = bytes / MB;
171 | double gigabytes = bytes / GB;
172 | if (gigabytes >= 1.0)
173 | formatted = [NSString stringWithFormat:@"%.2f GB", gigabytes];
174 | else if (megabytes >= 1.0)
175 | formatted = [NSString stringWithFormat:@"%.2f MB", megabytes];
176 | else
177 | formatted = [NSString stringWithFormat:@"%.2f bytes", bytes];
178 |
179 | return formatted;
180 | }
181 |
182 | vm_size_t machFreeMemory(void)
183 | {
184 | mach_port_t host_port = mach_host_self();
185 | mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
186 | vm_size_t pagesize;
187 | vm_statistics_data_t vm_stat;
188 |
189 | host_page_size(host_port, &pagesize);
190 | (void) host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size);
191 | return vm_stat.free_count * pagesize;
192 | }
193 |
194 | #pragma mark - Public
195 |
196 | /*
197 | #define AppVersionManagerKeyYourDeviceType @"deviceModelType"
198 | #define AppVersionManagerKeyGraphicalPerformance @"devicePowerInfo"
199 | #define AppVersionManagerKeyFreeDiskSpace @"freeDiskSpace"
200 | #define AppVersionManagerKeyBatteryLevel @"batteryLevel"
201 | #define AppVersionManagerKeyMobileProvisionning @"mobileProvisionning"
202 | */
203 |
204 | - (id)infoForKey:(NSString *)key
205 | {
206 | if ([key isEqualToString:AppVersionManagerKeyTargetedVersion]) {
207 | return [self targetedVersion];
208 | }
209 | else if ([key isEqualToString:AppVersionManagerKeyYouriOSVersion]) {
210 | return [self currentOSVersion];
211 | }
212 | else if ([key isEqualToString:AppVersionManagerKeyYourDeviceModel]) {
213 | return [self deviceModelName];
214 | }
215 | else if ([key isEqualToString:AppVersionManagerKeyCompilationSDK]) {
216 | return [self compilationSDK];
217 | }
218 | /*else if ([key isEqualToString:AppVersionManagerKeyWSConfiguration]) {
219 | return [self wSConfiguration];
220 | }*/
221 | else if ([key isEqualToString:AppVersionManagerKeyCFBundleVersion]) {
222 | return [self appVersion];
223 | }
224 | else if ([key isEqualToString:AppVersionManagerKeyCFBundleShortVersionString]) {
225 | return [self shortAppVersion];
226 | }
227 | else if ([key isEqualToString:AppVersionManagerKeyFreeDiskSpace]) {
228 | return [self freeDiskSpace];
229 | }
230 | else if ([key isEqualToString:AppVersionManagerKeyBatteryLevel]) {
231 | int batteryLevel = (int)[self batteryLevel];
232 | return [NSString stringWithFormat:@"%d%%",batteryLevel];
233 | }
234 | else if ([key isEqualToString:AppVersionManagerKeyMobileProvisionning]) {
235 | static JMOMobileProvisionning *provisionningObj;
236 | if (provisionningObj == nil) {
237 | provisionningObj = [self mobileProvisionning];
238 | }
239 | return provisionningObj;
240 | }
241 | /*else if ([key isEqualToString:AppVersionManagerKeyPushToken]) {
242 | return [self pushToken];
243 | }*/
244 | else if ([key isEqualToString:AppVersionManagerKeyFreeMemory]) {
245 | unsigned long freeSpace = machFreeMemory();
246 | unsigned long long totalMemory = [[NSProcessInfo processInfo] physicalMemory];
247 | CGFloat pourcent = (CGFloat)freeSpace/totalMemory;
248 | return [NSString stringWithFormat:@"%@ (%d%%)",[self.class memoryFormatter:freeSpace],(int)(100*pourcent)];
249 | }
250 | else if ([key isEqualToString:AppVersionManagerKeyOperator]) {
251 | return [self operatorName];
252 | }
253 | else if ([key isEqualToString:AppVersionManagerKeyGraphicalPerformance]) {
254 | JMODevicePowerInfos *graphInfo = [JMODevicePowerInfos infosForDeviceModelNamed:[UIDevice jmo_modelName]];
255 | if ([graphInfo hasGoodGraphicPerformance]) {
256 | return @"YES";
257 | }
258 | return @"NO";
259 | }
260 | else {
261 | id obj = [self.customValues objectForKey:key];
262 | if (nil != obj) {
263 | return obj;
264 | }
265 | }
266 | return @"";
267 | }
268 |
269 | - (void)addCustomValue:(NSString *)value forCustomKey:(NSString *)key
270 | {
271 | [self.customValues setValue:value forKey:key];
272 | }
273 |
274 | - (NSString *)htmlDescriptionWithKeys:(NSArray *)keys
275 | {
276 | NSMutableString *str = [NSMutableString new];
277 | [str appendString:@""];
278 |
279 | for (NSString *key in keys) {
280 | id info = [[AppInformationsManager sharedManager] infoForKey:key];
281 | if ([key isEqualToString:AppVersionManagerKeyMobileProvisionning]) {
282 | JMOMobileProvisionning *mobileProvi = (JMOMobileProvisionning *)info;
283 | [str appendFormat:@"%@ | %@ |
", key, mobileProvi.teamName ];
284 | }
285 | else {
286 | [str appendFormat:@"%@ | %@ |
", key, info];
287 | }
288 | }
289 |
290 | [str appendString:@"
"];
291 | return str;
292 | }
293 |
294 | @end
295 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/JMODevicePowerInfos.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMODevicePowerInfos.h
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 1/19/14.
6 | // Copyright (c) 2014 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface JMODevicePowerInfos : NSObject
12 |
13 | @property (strong, nonatomic) NSString *systemOnChip;
14 | @property (strong, nonatomic) NSString *deviceModel;
15 | @property (strong, nonatomic) NSString *cpu;
16 | @property (strong, nonatomic) NSString *gpu;
17 | @property (assign, nonatomic) NSUInteger futuremarkScore; //http://community.futuremark.com/hardware/mobile/
18 | @property (assign, nonatomic) NSUInteger geekbenchScore; //http://browser.primatelabs.com/ios-benchmarks
19 | @property (assign, nonatomic) BOOL retina;
20 | @property (assign, nonatomic, getter = hasGoodGraphicPerformance) BOOL goodPerformance;
21 |
22 | + (instancetype)infosForDeviceModelNamed:(NSString *)deviceModelName;
23 | + (void)sortAlldevices;
24 | - (BOOL)hasGoodGraphicPerformance;
25 |
26 | @end
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/JMODevicePowerInfos.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMODevicePowerInfos.m
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 1/19/14.
6 | // Copyright (c) 2014 Jerome Morissard. All rights reserved.
7 | //
8 |
9 |
10 | #define jmoiPadLimitOfBadPerformaceFuturemark 2500.0f //treshold base on realScore (futuremark)
11 | #define jmoiPadLimitOfBadPerformaceGeekbench 400.0f //treshold base on realScore (geekBench)
12 |
13 | #define jmoiPhoneLimitOfBadPerformaceFuturemark 200.0f //treshold base on realScore (futuremark)
14 | #define jmoiPhoneLimitOfBadPerformaceGeekbench 100.0f //treshold base on realScore (geekBench)
15 |
16 | #define jmoUndefinedScore -1
17 |
18 | #import "JMODevicePowerInfos.h"
19 | #import "UIDevice+iAppInfos.h"
20 | #import "JMOLogMacro.h"
21 |
22 | @implementation JMODevicePowerInfos
23 |
24 | - (instancetype)init
25 | {
26 | self = [super init];
27 | if (self) {
28 | _futuremarkScore = jmoUndefinedScore;
29 | _geekbenchScore = jmoUndefinedScore;
30 | _retina = (BOOL)([UIScreen mainScreen].scale == 2.0f);
31 | }
32 |
33 | return self;
34 | }
35 |
36 | + (instancetype)infosForDeviceModelNamed:(NSString *)deviceModelName
37 | {
38 | JMODevicePowerInfos *infos = [[JMODevicePowerInfos alloc] init];
39 | infos.deviceModel = deviceModelName;
40 |
41 | if ([deviceModelName isEqualToString:UIDeviceModeliPodTouch1G] ) {
42 | infos.systemOnChip = @"Samsung S5L8900";
43 | infos.cpu = @"ARM1176JZ(F)-S v1.0";
44 | infos.gpu = @"PowerVR MBX Lite";
45 | infos.futuremarkScore = 120;
46 | infos.geekbenchScore = 75;
47 | infos.retina = NO;
48 | }
49 | else if ([deviceModelName isEqualToString:UIDeviceModeliPhone1G] ) {
50 | infos.systemOnChip = @"Samsung S5L8900";
51 | infos.cpu = @"ARM1176JZ(F)-S v1.0";
52 | infos.gpu = @"PowerVR MBX Lite";
53 | infos.futuremarkScore = 120;
54 | infos.geekbenchScore = 75;
55 | infos.retina = NO;
56 | }
57 | else if ([deviceModelName isEqualToString:UIDeviceModeliPhone3G] ) {
58 | infos.systemOnChip = @"Samsung S5L8720";
59 | infos.gpu = @"PowerVR MBX Lite";
60 | infos.futuremarkScore = 120; //in theory iphone 3GS is 2.5% faster
61 | infos.geekbenchScore = 75;
62 | infos.retina = NO;
63 | }
64 | else if ([deviceModelName isEqualToString:UIDeviceModeliPodTouch2G] ) {
65 | infos.systemOnChip = @"Samsung S5L8720";
66 | infos.cpu = @"ARM1176JZ(F)-S v1.0";
67 | infos.gpu = @"PowerVR MBX Lite";
68 | infos.futuremarkScore = 120;
69 | infos.geekbenchScore = 75;
70 | infos.retina = NO;
71 | }
72 | else if ([deviceModelName isEqualToString:UIDeviceModeliPhone3GS] ) {
73 | infos.systemOnChip = @"Samsung S5PC100";
74 | infos.cpu = @"ARM Cortex-A8";
75 | infos.gpu = @"PowerVR SGX535";
76 | infos.futuremarkScore = 300; //in theory iphone 4 is 35% faster
77 | infos.geekbenchScore = 149;
78 | infos.retina = NO;
79 | }
80 | else if ([deviceModelName isEqualToString:UIDeviceModeliPodTouch3G] ) {
81 | infos.systemOnChip = @"Samsung S5PC100";
82 | infos.cpu = @"ARM Cortex-A8";
83 | infos.gpu = @"PowerVR SGX535";
84 | infos.futuremarkScore = 300;
85 | infos.geekbenchScore = 149;
86 | infos.retina = NO;
87 | }
88 | else if ([deviceModelName isEqualToString:UIDeviceModeliPad]) {
89 | infos.systemOnChip = @"Apple A4";
90 | infos.cpu = @"ARM Cortex-A8";
91 | infos.gpu = @"PowerVR SGX535";
92 | infos.futuremarkScore = 1434; //in theory ipad2/2
93 | infos.geekbenchScore = 200;
94 | infos.retina = NO;
95 | }
96 | else if ([deviceModelName isEqualToString:UIDeviceModeliPhone4] ||
97 | [deviceModelName isEqualToString:UIDeviceModelVerizoniPhone4] ) {
98 | infos.systemOnChip = @"Apple A4";
99 | infos.cpu = @"ARM Cortex-A8";
100 | infos.gpu = @"PowerVR SGX535";
101 | infos.futuremarkScore = 488;
102 | infos.geekbenchScore = 210;
103 | infos.retina = YES;
104 | }
105 | else if ([deviceModelName isEqualToString:UIDeviceModeliPodTouch4G] ) {
106 | infos.systemOnChip = @"Apple A4";
107 | infos.cpu = @"ARM Cortex-A8";
108 | infos.gpu = @"PowerVR SGX535";
109 | infos.futuremarkScore = 488;
110 | infos.geekbenchScore = 209;
111 | infos.retina = YES;
112 | }
113 | else if ([deviceModelName isEqualToString:UIDeviceModeliPad2_Wifi] ||
114 | [deviceModelName isEqualToString:UIDeviceModeliPad2_GSM] ||
115 | [deviceModelName isEqualToString:UIDeviceModeliPad2_CDMA] ||
116 | [deviceModelName isEqualToString:UIDeviceModeliPad2]) {
117 | infos.systemOnChip = @"Apple A5";
118 | infos.cpu = @"ARM Cortex-A9";
119 | infos.gpu = @"PowerVR SGX543MP2";
120 | infos.futuremarkScore = 2868;
121 | infos.geekbenchScore = 490;
122 | infos.retina = NO;
123 | }
124 | else if ([deviceModelName isEqualToString:UIDeviceModeliPhone4S] ) {
125 | infos.systemOnChip = @"Apple A5";
126 | infos.cpu = @"ARM Cortex-A9";
127 | infos.gpu = @"PowerVR SGX543MP2";
128 | infos.futuremarkScore = 2330;
129 | infos.geekbenchScore = 406;
130 | infos.retina = YES;
131 | }
132 | else if ([deviceModelName isEqualToString:UIDeviceModeliPad3G_Wifi] ||
133 | [deviceModelName isEqualToString:UIDeviceModeliPad3G_4G] ||
134 | [deviceModelName isEqualToString:UIDeviceModeliPad3G_4G]) {
135 | //http://community.futuremark.com/hardware/mobile/Apple+iPad+3/review
136 | infos.systemOnChip = @"Apple A5";
137 | infos.cpu = @"Apple A5X";
138 | infos.gpu = @"PowerVR SGX543MP4";
139 | infos.futuremarkScore = 4209;
140 | infos.geekbenchScore = 493;
141 | infos.retina = YES;
142 | }
143 | else if ([deviceModelName isEqualToString:UIDeviceModeliPhone5_GSM] ||
144 | [deviceModelName isEqualToString:UIDeviceModeliPhone5_GSM_CDMA] ) {
145 | infos.systemOnChip = @"Apple A6";
146 | infos.cpu = @"Swift (Apple-designed)";
147 | infos.gpu = @"PowerVR SGX543MP3";
148 | infos.futuremarkScore = 5689;
149 | infos.geekbenchScore = 1279;
150 | infos.retina = YES;
151 | }
152 | else if ([deviceModelName isEqualToString:UIDeviceModeliPodTouch5G] ) {
153 | infos.systemOnChip = @"Apple A5";
154 | infos.cpu = @"ARM Cortex-A9";
155 | infos.gpu = @"PowerVR SGX543MP2";
156 | infos.futuremarkScore = 2316;
157 | infos.geekbenchScore = 410;
158 | infos.retina = YES;
159 | }
160 | else if ([deviceModelName isEqualToString:UIDeviceModeliPad4G_Wifi] ||
161 | [deviceModelName isEqualToString:UIDeviceModeliPad4G_GSM] ||
162 | [deviceModelName isEqualToString:UIDeviceModeliPad4G_GSM_CDMA]) {
163 | infos.systemOnChip = @"Apple A6X";
164 | infos.cpu = @"Swift (Apple-designed)";
165 | infos.gpu = @"PowerVR SGX554MP4";
166 | infos.futuremarkScore = 9615;
167 | infos.geekbenchScore = 1409;
168 | infos.retina = YES;
169 | }
170 | else if ([deviceModelName isEqualToString:UIDeviceModeliPadMini1G_Wifi] ||
171 | [deviceModelName isEqualToString:UIDeviceModeliPadMini1G_GSM] ||
172 | [deviceModelName isEqualToString:UIDeviceModeliPadMini1G_GSM_CDMA]) {
173 | infos.systemOnChip = @"Apple A5";
174 | infos.cpu = @"ARM Cortex-A9";
175 | infos.gpu = @"PowerVR SGX543MP2";
176 | infos.futuremarkScore = 2847;
177 | infos.geekbenchScore = 492;
178 | infos.retina = NO;
179 | }
180 | else if ([deviceModelName isEqualToString:UIDeviceModeliPhone5C_GSM] ||
181 | [deviceModelName isEqualToString:UIDeviceModeliPhone5C_Global] ) {
182 | infos.systemOnChip = @"Apple A6";
183 | infos.cpu = @"Swift (Apple-designed)";
184 | infos.gpu = @"PowerVR SGX543MP3";
185 | infos.futuremarkScore = 5851;
186 | infos.geekbenchScore = 1248;
187 | infos.retina = YES;
188 | }
189 | else if ([deviceModelName isEqualToString:UIDeviceModeliPhone5S_GSM] ||
190 | [deviceModelName isEqualToString:UIDeviceModeliPhone5S_Global] ) {
191 | infos.systemOnChip = @"Apple A7";
192 | infos.cpu = @"Cyclone (Apple-designed)";
193 | infos.gpu = @"PowerVR G6430";
194 | infos.futuremarkScore = 9615*2; //in theory ipad4*2
195 | infos.geekbenchScore = 2488;
196 | infos.retina = YES;
197 | }
198 | else if ([deviceModelName isEqualToString:UIDeviceModeliPadMiniRetina2G_Wifi] ||
199 | [deviceModelName isEqualToString:UIDeviceModeliPadMiniRetina2G_Cellular] ) {
200 | infos.systemOnChip = @"Apple A7";
201 | infos.cpu = @"Cyclone (Apple-designed)";
202 | infos.gpu = @"PowerVR G6430";
203 | infos.futuremarkScore = 9615*2; //in theory ipad4*2
204 | infos.geekbenchScore = 2390;
205 | infos.retina = YES;
206 | }
207 | else if ([deviceModelName isEqualToString:UIDeviceModeliPadAir_Wifi] ||
208 | [deviceModelName isEqualToString:UIDeviceModeliPadAir_Cellular] ) {
209 | infos.systemOnChip = @"Apple A7";
210 | infos.cpu = @"Cyclone (Apple-designed)";
211 | infos.gpu = @"PowerVR G6430";
212 | infos.futuremarkScore = 9615*2; //in theory ipad4*2
213 | infos.geekbenchScore = 2594;
214 | infos.retina = YES;
215 | }
216 |
217 | else if ([deviceModelName isEqualToString:UIDeviceModeliPadAir_4GCellular]) {
218 | infos.systemOnChip = @"Apple A7";
219 | infos.cpu = @"Cyclone (Apple-designed)";
220 | infos.gpu = @"PowerVR G6430";
221 | infos.futuremarkScore = 9615*2; //in theory == UIDeviceModeliPadAir_Wifi
222 | infos.geekbenchScore = 2594;
223 | infos.retina = YES;
224 | }
225 | else if ([deviceModelName isEqualToString:UIDeviceModeliPadMiniRetina4G_Cellular] ) {
226 | infos.systemOnChip = @"Apple A7";
227 | infos.cpu = @"Cyclone (Apple-designed)";
228 | infos.gpu = @"PowerVR G6430";
229 | infos.futuremarkScore = 9615*2; //in theory == UIDeviceModeliPadAir_Wifi
230 | infos.geekbenchScore = 2390;
231 | infos.retina = YES;
232 | }
233 |
234 | return infos;
235 | }
236 |
237 | - (BOOL)hasGoodGraphicPerformance
238 | {
239 | //Return YES for hasGoodGraphicPerformance for unknow device (new devices are suppose to be better ...)
240 | if (self.futuremarkScore == jmoUndefinedScore || self.geekbenchScore == jmoUndefinedScore ) {
241 | return YES;
242 | }
243 |
244 | if ([self.deviceModel rangeOfString:@"Simulator"].location != NSNotFound) {
245 | return YES;
246 | }
247 | else if ([self.deviceModel rangeOfString:@"iPad"].location != NSNotFound) {
248 | if ([self realScore] < jmoiPadLimitOfBadPerformaceGeekbench) {
249 | return NO;
250 | }
251 | }
252 | else if ([self.deviceModel rangeOfString:@"iPhone"].location != NSNotFound) {
253 | if ([self realScore] < jmoiPadLimitOfBadPerformaceGeekbench) {
254 | return NO;
255 | }
256 | }
257 | else if ([self.deviceModel rangeOfString:@"iPod"].location != NSNotFound) {
258 | if ([self realScore] < jmoiPadLimitOfBadPerformaceGeekbench) {
259 | return NO;
260 | }
261 | }
262 |
263 | return YES;
264 | }
265 |
266 | #pragma mark -
267 |
268 | - (CGFloat)realScore
269 | {
270 | return [self geekbenchScoreCorrected];
271 | }
272 |
273 | - (CGFloat)futuremarkScoreCorrected
274 | {
275 | CGFloat retinaCost = 2.0f;
276 | if (self.retina) {
277 | return ((CGFloat)self.futuremarkScore/retinaCost);
278 | }
279 | return (CGFloat)self.futuremarkScore;
280 | }
281 |
282 | - (CGFloat)geekbenchScoreCorrected
283 | {
284 | CGFloat retinaCost = 2.0f;
285 | if (self.retina) {
286 | return ((CGFloat)self.self.geekbenchScore/retinaCost);
287 | }
288 | return (CGFloat)self.self.geekbenchScore;
289 | }
290 |
291 | #pragma mark -
292 |
293 | + (void)sortAlldevices
294 | {
295 | //IPADS
296 | JMOLog(@"IPADS ");
297 |
298 | NSArray *alliPadDevices = @[UIDeviceModeliPad,UIDeviceModeliPad2_Wifi,UIDeviceModeliPad3G_Wifi,UIDeviceModeliPad4G_Wifi,UIDeviceModeliPadMini1G_Wifi,UIDeviceModeliPadMiniRetina2G_Wifi,UIDeviceModeliPadAir_Wifi];
299 | NSMutableArray *arrayOfDeviceInfos = [NSMutableArray new];
300 | for (NSString *deviceName in alliPadDevices) {
301 | [arrayOfDeviceInfos addObject:[self.class infosForDeviceModelNamed:deviceName]];
302 | }
303 |
304 | NSArray *iPadSorted = [arrayOfDeviceInfos sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(JMODevicePowerInfos *obj1, JMODevicePowerInfos *obj2) {
305 | if ([obj1 realScore] > [obj2 realScore] ) {
306 | return NSOrderedAscending;
307 | }
308 | else if ([obj2 realScore] > [obj1 realScore] ) {
309 | return NSOrderedDescending;
310 | }
311 | return NSOrderedSame;
312 | }];
313 |
314 | int i = 1;
315 | for (JMODevicePowerInfos *info in iPadSorted) {
316 | NSLog(@"%d\t%@ %f",i, info.deviceModel, [info realScore]);
317 | i++;
318 | }
319 |
320 | //IPHONES
321 | JMOLog(@"IPHONES ");
322 |
323 | NSArray *alliPhoneDevices = @[UIDeviceModeliPhone1G,UIDeviceModeliPhone3G, UIDeviceModeliPhone3GS,UIDeviceModeliPhone4,UIDeviceModeliPhone4S, UIDeviceModeliPhone5_GSM,UIDeviceModeliPhone5C_GSM,UIDeviceModeliPhone5S_GSM ];
324 | arrayOfDeviceInfos = [NSMutableArray new];
325 | for (NSString *deviceName in alliPhoneDevices) {
326 | [arrayOfDeviceInfos addObject:[self.class infosForDeviceModelNamed:deviceName]];
327 | }
328 |
329 | NSArray *iphoneSorted = [arrayOfDeviceInfos sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(JMODevicePowerInfos *obj1, JMODevicePowerInfos *obj2) {
330 | if ([obj1 realScore] > [obj2 realScore] ) {
331 | return NSOrderedAscending;
332 | }
333 | else if ([obj2 realScore] > [obj1 realScore] ) {
334 | return NSOrderedDescending;
335 | }
336 | return NSOrderedSame;
337 | }];
338 |
339 | i = 1;
340 | for (JMODevicePowerInfos *info in iphoneSorted) {
341 | NSLog(@"%d\t%@ %f",i, info.deviceModel, [info realScore]);
342 | i++;
343 | }
344 |
345 | }
346 |
347 | @end
348 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/JMOLogMacro.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Jerome Morissard on 12/29/13.
3 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
4 | //
5 |
6 | #ifndef iAppInfos_LogMacro_h
7 | #define iAppInfos_LogMacro_h
8 |
9 | // Log using the same parameters above but include the function name and source code line number in the log statement
10 | #ifdef DEBUG
11 | #define JMOLog(fmt, ...) NSLog((@"Func: %s, Line: %d, " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
12 | #else
13 | #define JMOLog(...)
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/JMOMobileProvisionning.h:
--------------------------------------------------------------------------------
1 | //
2 | // JMOMobileProvisionning.h
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #define MobileProvisioningAppIDName @"AppIDName"
12 | #define MobileProvisioningApplicationIdentifierPrefix @"ApplicationIdentifierPrefix"
13 | #define MobileProvisioningCreationDate @"CreationDate"
14 | #define MobileProvisioningEntitlements @"Entitlements"
15 | #define MobileProvisioningExpirationDate @"ExpirationDate"
16 | #define MobileProvisioningName @"Name"
17 | #define MobileProvisioningProvisionedDevices @"ProvisionedDevices"
18 | #define MobileProvisioningTeamName @"TeamName"
19 | #define MobileProvisioningGetTaskAllow @"get-task-allow"
20 | #define MobileProvisioningApsEnvironment @"aps-environment"
21 |
22 | typedef NS_ENUM(NSUInteger, JMOMobileProvisionningPushConfiguration) {
23 | JMOMobileProvisionningPushConfigurationDisable,
24 | JMOMobileProvisionningPushConfigurationDevelopment,
25 | JMOMobileProvisionningPushConfigurationProduction
26 | };
27 |
28 | @interface JMOMobileProvisionning : NSObject
29 |
30 | @property (strong, nonatomic) NSDictionary *summary;
31 | @property (strong, nonatomic) NSString *appIDName;
32 | @property (strong, nonatomic) NSArray *applicationIdentifierPrefix;
33 | @property (strong, nonatomic) NSString *creationDate;
34 | @property (strong, nonatomic) NSString *expirationDate;
35 | @property (strong, nonatomic) NSArray *entitlements;
36 | @property (strong, nonatomic) NSString *name;
37 | @property (strong, nonatomic) NSArray *provisionedDevices;
38 | @property (strong, nonatomic) NSString *teamName;
39 | @property (strong, nonatomic) NSString *isDevMobileProvisioning;
40 | @property (strong, nonatomic) NSString *apsEnvironment;
41 | @property (assign, readonly, nonatomic) JMOMobileProvisionningPushConfiguration pushConfiguration;
42 |
43 | - (instancetype)initWithDictionary:(NSDictionary *)dict;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/JMOMobileProvisionning.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMOMobileProvisionning.m
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import "JMOMobileProvisionning.h"
10 |
11 | @interface JMOMobileProvisionning ()
12 | @end
13 |
14 | @implementation JMOMobileProvisionning
15 |
16 | - (instancetype)initWithDictionary:(NSDictionary *)dict
17 | {
18 | self = [super init];
19 | if (self) {
20 | if ([dict objectForKey:MobileProvisioningAppIDName]) {
21 | _appIDName = [dict objectForKey:MobileProvisioningAppIDName];
22 | }
23 |
24 | if ([dict objectForKey:MobileProvisioningApplicationIdentifierPrefix]) {
25 | _applicationIdentifierPrefix = [dict objectForKey:MobileProvisioningApplicationIdentifierPrefix];
26 | }
27 |
28 | if ([dict objectForKey:MobileProvisioningCreationDate]) {
29 | _creationDate = [dict objectForKey:MobileProvisioningCreationDate];
30 | }
31 |
32 | if ([dict objectForKey:MobileProvisioningExpirationDate]) {
33 | _expirationDate = [dict objectForKey:MobileProvisioningExpirationDate];
34 | }
35 |
36 | if ([dict objectForKey:MobileProvisioningEntitlements]) {
37 | _entitlements = [dict objectForKey:MobileProvisioningEntitlements];
38 | }
39 |
40 | if ([dict objectForKey:MobileProvisioningName]) {
41 | _name = [dict objectForKey:MobileProvisioningName];
42 | }
43 |
44 | if ([dict objectForKey:MobileProvisioningTeamName]) {
45 | _teamName = [dict objectForKey:MobileProvisioningTeamName];
46 | }
47 |
48 | if ([dict objectForKey:MobileProvisioningProvisionedDevices]) {
49 | _provisionedDevices = [dict objectForKey:MobileProvisioningProvisionedDevices];
50 | }
51 |
52 | if ([dict objectForKey:MobileProvisioningGetTaskAllow]) {
53 | _isDevMobileProvisioning = [dict objectForKey:MobileProvisioningGetTaskAllow];
54 | }
55 |
56 | if ([dict objectForKey:MobileProvisioningApsEnvironment]) {
57 | _apsEnvironment = [dict objectForKey:MobileProvisioningApsEnvironment];
58 | }
59 |
60 | _summary = dict;
61 | }
62 |
63 | return self;
64 | }
65 |
66 | - (JMOMobileProvisionningPushConfiguration)pushConfiguration
67 | {
68 | if ([_apsEnvironment isEqualToString:@"development"]) {
69 | return JMOMobileProvisionningPushConfigurationDevelopment;
70 | } else if ([_apsEnvironment isEqualToString:@"production"]) {
71 | return JMOMobileProvisionningPushConfigurationProduction;
72 | }
73 |
74 | return JMOMobileProvisionningPushConfigurationDisable;
75 | }
76 |
77 | - (NSDictionary *)summary //Overided setter, to change keyName
78 | {
79 | NSMutableDictionary *editedDict = [_summary mutableCopy];
80 |
81 | NSString *value = [_summary objectForKey:MobileProvisioningGetTaskAllow];
82 | [editedDict removeObjectForKey:MobileProvisioningGetTaskAllow];
83 | if ([value isEqualToString:@"true"]) {
84 | [editedDict setObject:@"YES" forKey:@"Mobile Provisioning Development"];
85 | }
86 | else {
87 | [editedDict setObject:@"NO" forKey:@"Mobile Provisioning Development"];
88 | }
89 |
90 | value = [_summary objectForKey:MobileProvisioningApsEnvironment];
91 | [editedDict removeObjectForKey:MobileProvisioningApsEnvironment];
92 | if ([value isEqualToString:@"development"]) {
93 | [editedDict setObject:@"YES" forKey:@"Push Enable (DEV)"];
94 | } else if ([value isEqualToString:@"production"]) {
95 | [editedDict setObject:@"YES" forKey:@"Push Enable (PROD)"];
96 | } else {
97 | [editedDict setObject:@"NO" forKey:@"Push Enable"];
98 | }
99 |
100 | return editedDict;
101 | }
102 |
103 | - (NSString *)description
104 | {
105 | return self.summary.description;
106 | }
107 |
108 |
109 | @end
110 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/NSDictionary+iAppInfos.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDictionary+iAppInfos.h
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSDictionary (iAppInfos)
12 |
13 | + (NSDictionary *)jmo_dictionaryWithDefaultMobileProvisioning;
14 | + (NSDictionary *)jmo_dictionaryWithMobileProvisioningString:(NSString *)RawMobileProvisionning;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/NSDictionary+iAppInfos.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSDictionary+iAppInfos.m
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import "NSDictionary+iAppInfos.h"
10 | #import "JMOMobileProvisionning.h"
11 |
12 | @implementation NSDictionary (MobileProvisionningParser)
13 |
14 | + (NSDictionary *)jmo_dictionaryWithDefaultMobileProvisioning
15 | {
16 | // There is no provisioning profile in AppStore Apps
17 | NSString *profilePath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];
18 | NSString *result = nil;
19 |
20 | // Check provisioning profile existence
21 | if (profilePath)
22 | {
23 | // Get hex representation
24 | NSData *profileData = [NSData dataWithContentsOfFile:profilePath];
25 | NSString *profileString = [NSString stringWithFormat:@"%@", profileData];
26 |
27 | // Remove brackets at beginning and end
28 | profileString = [profileString stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:@""];
29 | profileString = [profileString stringByReplacingCharactersInRange:NSMakeRange(profileString.length - 1, 1) withString:@""];
30 |
31 | // Remove spaces
32 | profileString = [profileString stringByReplacingOccurrencesOfString:@" " withString:@""];
33 |
34 | // Convert hex values to readable characters
35 | NSMutableString *profileText = [NSMutableString new];
36 | for (int i = 0; i < profileString.length; i += 2)
37 | {
38 | NSString *hexChar = [profileString substringWithRange:NSMakeRange(i, 2)];
39 | int value = 0;
40 | sscanf([hexChar cStringUsingEncoding:NSASCIIStringEncoding], "%x", &value);
41 | [profileText appendFormat:@"%c", (char)value];
42 | }
43 |
44 | NSRange range1 = [profileText rangeOfString:@""];
47 | if ( range2.location != NSNotFound ) {
48 | NSRange range = NSMakeRange(range1.location, range2.location + range2.length - range1.location);
49 | result = [profileText substringWithRange:range];
50 |
51 | NSDictionary *dict = [NSDictionary jmo_dictionaryWithMobileProvisioningString:result];
52 | return dict;
53 | }
54 | }
55 |
56 | }
57 |
58 | return nil;
59 | }
60 |
61 | + (NSDictionary *)jmo_dictionaryWithMobileProvisioningString:(NSString *)RawMobileProvisionning
62 | {
63 | NSMutableDictionary *dictionary = [NSMutableDictionary new];
64 | NSArray* lines = [RawMobileProvisionning componentsSeparatedByCharactersInSet: [NSCharacterSet newlineCharacterSet]];
65 |
66 | for (int i = 0; i < lines.count; i++) {
67 | NSString *line = [lines objectAtIndex:i];
68 | if ([self lineString:line containsKey:MobileProvisioningAppIDName]) {
69 | NSString *nextLine = [lines objectAtIndex:i+1];
70 | NSString *appIDName = [self extractStringValueInLine:nextLine];
71 | if (appIDName.length > 0) {
72 | [dictionary setObject:appIDName forKey:MobileProvisioningAppIDName];
73 | continue;
74 | }
75 | }
76 |
77 | if ([self lineString:line containsKey:MobileProvisioningApplicationIdentifierPrefix]) {
78 | NSString *nextLine = [lines objectAtIndex:i+1];
79 | NSMutableArray *arryOfApplicationIdentifierPrefix = [NSMutableArray new];
80 | while ([nextLine rangeOfString:@""].location == NSNotFound) {
81 | NSString *value = [self extractStringValueInLine:nextLine];
82 | if (value.length > 0) {
83 | [arryOfApplicationIdentifierPrefix addObject:value];
84 | }
85 | i++;
86 | nextLine = [lines objectAtIndex:i];
87 | }
88 |
89 | [dictionary setObject:arryOfApplicationIdentifierPrefix forKey:MobileProvisioningApplicationIdentifierPrefix];
90 | }
91 |
92 | if ([self lineString:line containsKey:MobileProvisioningCreationDate]) {
93 | NSString *nextLine = [lines objectAtIndex:i+1];
94 | NSString *creationDate = [self extractDateValueInLine:nextLine];
95 | if (nil != creationDate) {
96 | [dictionary setObject:creationDate forKey:MobileProvisioningCreationDate];
97 | continue;
98 | }
99 | }
100 |
101 | if ([self lineString:line containsKey:MobileProvisioningExpirationDate]) {
102 | NSString *nextLine = [lines objectAtIndex:i+1];
103 | NSString *creationDate = [self extractDateValueInLine:nextLine];
104 | if (nil != creationDate) {
105 | [dictionary setObject:creationDate forKey:MobileProvisioningExpirationDate];
106 | continue;
107 | }
108 | }
109 |
110 | if ([self lineString:line containsKey:MobileProvisioningName]) {
111 | NSString *nextLine = [lines objectAtIndex:i+1];
112 | NSString *name = [self extractStringValueInLine:nextLine];
113 | if (nil != name) {
114 | [dictionary setObject:name forKey:MobileProvisioningName];
115 | continue;
116 | }
117 | }
118 |
119 | if ([self lineString:line containsKey:MobileProvisioningProvisionedDevices]) {
120 | NSString *nextLine = [lines objectAtIndex:i+1];
121 | NSMutableArray *arryOfProvisionedDevices = [NSMutableArray new];
122 | while ([nextLine rangeOfString:@""].location == NSNotFound) {
123 | NSString *value = [self extractStringValueInLine:nextLine];
124 | if (value.length > 0) {
125 | [arryOfProvisionedDevices addObject:value];
126 | }
127 |
128 | i++;
129 | nextLine = [lines objectAtIndex:i];
130 | }
131 |
132 | [dictionary setObject:arryOfProvisionedDevices forKey:MobileProvisioningProvisionedDevices];
133 | continue;
134 | }
135 |
136 | if ([self lineString:line containsKey:MobileProvisioningTeamName]) {
137 | NSString *nextLine = [lines objectAtIndex:i+1];
138 | NSString *creationDate = [self extractStringValueInLine:nextLine];
139 | if (nil != creationDate) {
140 | [dictionary setObject:creationDate forKey:MobileProvisioningTeamName];
141 | continue;
142 | }
143 | }
144 |
145 | if ([self lineString:line containsKey:MobileProvisioningGetTaskAllow]) {
146 | NSString *nextLine = [lines objectAtIndex:i+1];
147 | NSString *isDevMobileProvisioning = [self extractBoolValueInLine:nextLine];
148 | if (nil != isDevMobileProvisioning) {
149 | [dictionary setObject:isDevMobileProvisioning forKey:MobileProvisioningGetTaskAllow];
150 | continue;
151 | }
152 | }
153 |
154 | if ([self lineString:line containsKey:MobileProvisioningApsEnvironment]) {
155 | NSString *nextLine = [lines objectAtIndex:i+1];
156 | NSString *apsEnv = [self extractStringValueInLine:nextLine];
157 | if (nil != apsEnv) {
158 | [dictionary setObject:apsEnv forKey:MobileProvisioningApsEnvironment];
159 | continue;
160 | }
161 |
162 | }
163 | }
164 |
165 | return dictionary;
166 | }
167 |
168 | + (BOOL)lineString:(NSString *)line containsKey:(NSString *)key
169 | {
170 | if ([line rangeOfString:[NSString stringWithFormat:@"%@", key]].location != NSNotFound) {
171 | return YES;
172 | }
173 | return NO;
174 | }
175 |
176 | + (NSString *)extractStringValueInLine:(NSString *)line
177 | {
178 | NSRange rangeStart = [line rangeOfString:@""];
179 | NSRange rangeEnd = [line rangeOfString:@""];
180 | if (rangeStart.location != NSNotFound && rangeEnd.location != NSNotFound ) {
181 | return [line substringWithRange:NSMakeRange(rangeStart.location+rangeStart.length, rangeEnd.location - (rangeStart.location+rangeStart.length) )];
182 | }
183 |
184 | return @"";
185 | }
186 |
187 | + (NSString *)extractDateValueInLine:(NSString *)line
188 | {
189 | NSRange rangeStart = [line rangeOfString:@""];
190 | NSRange rangeEnd = [line rangeOfString:@""];
191 | if (rangeStart.location != NSNotFound && rangeEnd.location != NSNotFound ) {
192 | return [line substringWithRange:NSMakeRange(rangeStart.location+rangeStart.length, rangeEnd.location - (rangeStart.location+rangeStart.length) )];
193 | }
194 |
195 | return @"";
196 | }
197 |
198 | + (NSString *)extractBoolValueInLine:(NSString *)line
199 | {
200 | NSRange rangeTrue = [line rangeOfString:@"true"];
201 | if (rangeTrue.location != NSNotFound ) {
202 | return @"true";
203 | }
204 |
205 | return @"false";
206 | }
207 |
208 |
209 | @end
210 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/UIApplication+iAppInfos.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIApplication+iAppInfos.h
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIApplication (iAppInfos)
12 |
13 | + (NSString *)jmo_iOSSDKVersion;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/UIApplication+iAppInfos.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIApplication+iAppInfos.m
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import "UIApplication+iAppInfos.h"
10 | #import
11 |
12 | @implementation UIApplication (iAppInfos)
13 |
14 | + (NSString *)jmo_iOSSDKVersion
15 | {
16 | #if defined(__IPHONE_8_0)
17 | return @"SDK8.0 (Xcode6.0)";
18 | #elif defined(__IPHONE_7_1)
19 | return @"SDK7.1 (Xcode5.1)";
20 | #elif defined(__IPHONE_7_0)
21 | //#warning "SDK7"
22 | return @"SDK7.0 (Xcode5)";
23 | #elif defined(__IPHONE_6_1)
24 | //#warning "SDK6.1"
25 | return @"SDK6.1 (Xcode4)";
26 | #elif defined(__IPHONE_5_1)
27 | //#warning "SDK5.1"
28 | return @"SDK5.1 (Xcode4)";
29 | #else
30 | //#warning "SDK<5"
31 | return @"SDK<5.1 (Xcode?)";
32 | #endif
33 | }
34 |
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/UIDevice+iAppInfos.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIDevice+iAppInfos.h
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | extern NSString * const UIDeviceModeliPhone1G;
12 | extern NSString * const UIDeviceModeliPhone3G;
13 | extern NSString * const UIDeviceModeliPhone3GS;
14 |
15 | extern NSString * const UIDeviceModeliPhone4;
16 | extern NSString * const UIDeviceModelVerizoniPhone4;
17 | extern NSString * const UIDeviceModeliPhone4S;
18 |
19 | extern NSString * const UIDeviceModeliPhone5_GSM;
20 | extern NSString * const UIDeviceModeliPhone5_GSM_CDMA;
21 | extern NSString * const UIDeviceModeliPhone5C_GSM;
22 | extern NSString * const UIDeviceModeliPhone5C_Global;
23 |
24 | extern NSString * const UIDeviceModeliPhone5S_GSM;
25 | extern NSString * const UIDeviceModeliPhone5S_Global;
26 |
27 | extern NSString * const UIDeviceModeliPodTouch1G;
28 | extern NSString * const UIDeviceModeliPodTouch2G;
29 | extern NSString * const UIDeviceModeliPodTouch3G;
30 | extern NSString * const UIDeviceModeliPodTouch4G;
31 | extern NSString * const UIDeviceModeliPodTouch5G;
32 |
33 | extern NSString * const UIDeviceModeliPad;
34 | extern NSString * const UIDeviceModeliPad2_Wifi;
35 | extern NSString * const UIDeviceModeliPad2_GSM;
36 | extern NSString * const UIDeviceModeliPad2_CDMA;
37 | extern NSString * const UIDeviceModeliPad2;
38 | extern NSString * const UIDeviceModeliPad3G_Wifi;
39 | extern NSString * const UIDeviceModeliPad3G_4G;
40 | extern NSString * const UIDeviceModeliPad4G_Wifi;
41 | extern NSString * const UIDeviceModeliPad4G_GSM;
42 | extern NSString * const UIDeviceModeliPad4G_GSM_CDMA;
43 |
44 | extern NSString * const UIDeviceModeliPadMini1G_Wifi;
45 | extern NSString * const UIDeviceModeliPadMini1G_GSM;
46 | extern NSString * const UIDeviceModeliPadMini1G_GSM_CDMA;
47 | extern NSString * const UIDeviceModeliPadMiniRetina2G_Wifi;
48 | extern NSString * const UIDeviceModeliPadMiniRetina2G_Cellular;
49 | extern NSString * const UIDeviceModeliPadAir_Wifi;
50 | extern NSString * const UIDeviceModeliPadAir_Cellular;
51 | extern NSString * const UIDeviceModeliPadAir_4GCellular;
52 | extern NSString * const UIDeviceModeliPadMiniRetina4G_Cellular;
53 |
54 | extern NSString * const UIDeviceModelSimulatorI386;
55 | extern NSString * const UIDeviceModelSimulatorX86_64;
56 | extern NSString * const UIDeviceModelSimulator;
57 |
58 | typedef NS_ENUM(NSInteger, UIDeviceModelType) {
59 | UIDeviceModelTypeiPhone,
60 | UIDeviceModelTypeiPod,
61 | UIDeviceModelTypeiPad,
62 | UIDeviceModelTypeSimulator
63 | };
64 |
65 | @class JMODevicePowerInfos;
66 | @interface UIDevice (iAppInfos)
67 |
68 | /**
69 | * jmo_modelName give a more explicit name of the device model
70 | *
71 | * @return NSString, a better device model name
72 | */
73 | + (NSString *)jmo_modelName;
74 |
75 | /**
76 | * Whether the device is an iPod, iPhone, or iPad. If it is not explicitly any of those,
77 | * the device is assumed to be a simulator.
78 | *
79 | * @return UIDeviceModelType
80 | */
81 | + (UIDeviceModelType)jmo_deviceModelType;
82 |
83 | /**
84 | *
85 | * @return JMODevicePowerInfos object
86 | */
87 | + (JMODevicePowerInfos *)jmo_devicePowerInfos;
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/iAppInfos/UIDevice+iAppInfos.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIDevice+iAppInfos.m
3 | // iAppInfos
4 | //
5 | // Created by Jerome Morissard on 11/21/13.
6 | // Copyright (c) 2013 Jerome Morissard. All rights reserved.
7 | //
8 |
9 | #import "UIDevice+iAppInfos.h"
10 | #import "JMODevicePowerInfos.h"
11 |
12 | #include
13 |
14 | NSString * const UIDeviceModeliPhone1G = @"iPhone 1G";
15 | NSString * const UIDeviceModeliPhone3G = @"iPhone 3G";
16 | NSString * const UIDeviceModeliPhone3GS = @"iPhone 3GS";
17 |
18 | NSString * const UIDeviceModeliPhone4 = @"iPhone 4";
19 | NSString * const UIDeviceModelVerizoniPhone4 = @"Verizon iPhone 4";
20 | NSString * const UIDeviceModeliPhone4S = @"iPhone 4S";
21 |
22 | NSString * const UIDeviceModeliPhone5_GSM = @"iPhone 5 (GSM)";
23 | NSString * const UIDeviceModeliPhone5_GSM_CDMA = @"iPhone 5 (GSM+CDMA)";
24 | NSString * const UIDeviceModeliPhone5C_GSM = @"iPhone 5C (GSM)";
25 | NSString * const UIDeviceModeliPhone5C_Global = @"iPhone 5C (Global)";
26 |
27 | NSString * const UIDeviceModeliPhone5S_GSM = @"iPhone 5S (GSM)";
28 | NSString * const UIDeviceModeliPhone5S_Global = @"iPhone 5S (Global)";
29 |
30 | NSString * const UIDeviceModeliPodTouch1G = @"iPod Touch 1G";
31 | NSString * const UIDeviceModeliPodTouch2G = @"iPod Touch 2G";
32 | NSString * const UIDeviceModeliPodTouch3G = @"iPod Touch 3G";
33 | NSString * const UIDeviceModeliPodTouch4G = @"iPod Touch 4G";
34 | NSString * const UIDeviceModeliPodTouch5G = @"iPod Touch 5G";
35 |
36 | NSString * const UIDeviceModeliPad = @"iPad";
37 | NSString * const UIDeviceModeliPad2_Wifi = @"iPad 2 (WiFi)";
38 | NSString * const UIDeviceModeliPad2_GSM = @"iPad 2 (GSM)";
39 | NSString * const UIDeviceModeliPad2_CDMA = @"iPad 2 (CDMA)";
40 | NSString * const UIDeviceModeliPad2 = @"iPad 2";
41 | NSString * const UIDeviceModeliPad3G_Wifi = @"iPad-3G (WiFi)";
42 | NSString * const UIDeviceModeliPad3G_4G = @"iPad-3G (4G)";
43 | NSString * const UIDeviceModeliPad4G_Wifi = @"iPad-4G (WiFi)";
44 | NSString * const UIDeviceModeliPad4G_GSM = @"iPad-4G (GSM)";
45 | NSString * const UIDeviceModeliPad4G_GSM_CDMA = @"iPad-4G (GSM+CDMA)";
46 |
47 | NSString * const UIDeviceModeliPadMini1G_Wifi = @"iPad mini-1G (WiFi)";
48 | NSString * const UIDeviceModeliPadMini1G_GSM = @"iPad mini-1G (GSM)";
49 | NSString * const UIDeviceModeliPadMini1G_GSM_CDMA = @"iPad mini-1G (GSM+CDMA)";
50 | NSString * const UIDeviceModeliPadMiniRetina2G_Wifi = @"iPad mini 2G Retina (WiFi)";
51 | NSString * const UIDeviceModeliPadMiniRetina2G_Cellular = @"iPad mini 2G Retina (Cellular)";
52 | NSString * const UIDeviceModeliPadAir_Wifi = @"iPad Air (WiFi)";
53 | NSString * const UIDeviceModeliPadAir_Cellular = @"iPad Air (Cellular)";
54 | NSString * const UIDeviceModeliPadAir_4GCellular = @"iPad Air (4G)";
55 | NSString * const UIDeviceModeliPadMiniRetina4G_Cellular = @"iPad mini (4G)";
56 |
57 | NSString * const UIDeviceModelSimulatorI386 = @"iPhone Simulator (i386)";
58 | NSString * const UIDeviceModelSimulatorX86_64 = @"iPhone Simulator (x86_64)";
59 | NSString * const UIDeviceModelSimulator = @"iPhone Simulator";
60 |
61 |
62 | @implementation UIDevice (iAppInfos)
63 |
64 | + (NSString *) jmo_getSysInfo
65 | {
66 | size_t size;
67 | sysctlbyname("hw.machine", NULL, &size, NULL, 0);
68 |
69 | char *answer = malloc(size);
70 | sysctlbyname("hw.machine", answer, &size, NULL, 0);
71 |
72 | NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
73 |
74 | free(answer);
75 | return results;
76 | }
77 |
78 | + (NSString *)jmo_modelName
79 | {
80 | NSString *systInfo = [self jmo_getSysInfo];
81 | if ([systInfo isEqualToString:@"iPhone1,1"]) return UIDeviceModeliPhone1G;
82 | if ([systInfo isEqualToString:@"iPhone1,2"]) return UIDeviceModeliPhone3G;
83 | if ([systInfo isEqualToString:@"iPhone2,1"]) return UIDeviceModeliPhone3GS;
84 | if ([systInfo isEqualToString:@"iPhone3,1"]) return UIDeviceModeliPhone4;
85 | if ([systInfo isEqualToString:@"iPhone3,3"]) return UIDeviceModelVerizoniPhone4;
86 | if ([systInfo isEqualToString:@"iPhone4,1"]) return UIDeviceModeliPhone4S;
87 | if ([systInfo isEqualToString:@"iPhone5,1"]) return UIDeviceModeliPhone5_GSM;
88 | if ([systInfo isEqualToString:@"iPhone5,2"]) return UIDeviceModeliPhone5_GSM_CDMA;
89 | if ([systInfo isEqualToString:@"iPhone5,3"]) return UIDeviceModeliPhone5C_GSM;
90 | if ([systInfo isEqualToString:@"iPhone5,4"]) return UIDeviceModeliPhone5C_Global;
91 | if ([systInfo isEqualToString:@"iPhone6,1"]) return UIDeviceModeliPhone5S_GSM;
92 | if ([systInfo isEqualToString:@"iPhone6,2"]) return UIDeviceModeliPhone5S_Global;
93 | if ([systInfo isEqualToString:@"iPod1,1"]) return UIDeviceModeliPodTouch1G;
94 | if ([systInfo isEqualToString:@"iPod2,1"]) return UIDeviceModeliPodTouch2G;
95 | if ([systInfo isEqualToString:@"iPod3,1"]) return UIDeviceModeliPodTouch3G;
96 | if ([systInfo isEqualToString:@"iPod4,1"]) return UIDeviceModeliPodTouch4G;
97 | if ([systInfo isEqualToString:@"iPod5,1"]) return UIDeviceModeliPodTouch5G;
98 | if ([systInfo isEqualToString:@"iPad1,1"]) return UIDeviceModeliPad;
99 | if ([systInfo isEqualToString:@"iPad2,1"]) return UIDeviceModeliPad2_Wifi;
100 | if ([systInfo isEqualToString:@"iPad2,2"]) return UIDeviceModeliPad2_GSM;
101 | if ([systInfo isEqualToString:@"iPad2,3"]) return UIDeviceModeliPad2_CDMA;
102 | if ([systInfo isEqualToString:@"iPad2,4"]) return UIDeviceModeliPad2;
103 | if ([systInfo isEqualToString:@"iPad3,1"]) return UIDeviceModeliPad3G_Wifi;
104 | if ([systInfo isEqualToString:@"iPad3,2"]) return UIDeviceModeliPad3G_4G;
105 | if ([systInfo isEqualToString:@"iPad3,3"]) return UIDeviceModeliPad3G_4G;
106 | if ([systInfo isEqualToString:@"iPad3,4"]) return UIDeviceModeliPad4G_Wifi;
107 | if ([systInfo isEqualToString:@"iPad3,5"]) return UIDeviceModeliPad4G_GSM;
108 | if ([systInfo isEqualToString:@"iPad3,6"]) return UIDeviceModeliPad4G_GSM_CDMA;
109 | if ([systInfo isEqualToString:@"iPad2,5"]) return UIDeviceModeliPadMini1G_Wifi;
110 | if ([systInfo isEqualToString:@"iPad2,6"]) return UIDeviceModeliPadMini1G_GSM;
111 | if ([systInfo isEqualToString:@"iPad2,7"]) return UIDeviceModeliPadMini1G_GSM_CDMA;
112 | if ([systInfo isEqualToString:@"iPad4,4"]) return UIDeviceModeliPadMiniRetina2G_Wifi;
113 | if ([systInfo isEqualToString:@"iPad4,5"]) return UIDeviceModeliPadMiniRetina2G_Cellular;
114 | if ([systInfo isEqualToString:@"iPad4,1"]) return UIDeviceModeliPadAir_Wifi;
115 | if ([systInfo isEqualToString:@"iPad4,2"]) return UIDeviceModeliPadAir_Cellular;
116 | if ([systInfo isEqualToString:@"iPad4,3"]) return UIDeviceModeliPadAir_4GCellular;
117 | if ([systInfo isEqualToString:@"iPad4,6"]) return UIDeviceModeliPadMiniRetina4G_Cellular;
118 | if ([systInfo isEqualToString:@"i386"]) return UIDeviceModelSimulator;
119 | if ([systInfo isEqualToString:@"x86_64"]) return UIDeviceModelSimulator;
120 |
121 | return systInfo;
122 | }
123 |
124 |
125 | + (UIDeviceModelType)jmo_deviceModelType {
126 | NSString *modelName = [self jmo_modelName];
127 |
128 | if ([modelName rangeOfString:@"iPhone"].location != NSNotFound) {
129 | return UIDeviceModelTypeiPhone;
130 | }
131 | else if ([modelName rangeOfString:@"iPod"].location != NSNotFound) {
132 | return UIDeviceModelTypeiPod;
133 | }
134 | else if ([modelName rangeOfString:@"iPad"].location != NSNotFound) {
135 | return UIDeviceModelTypeiPad;
136 | }
137 |
138 | return UIDeviceModelTypeSimulator;
139 | }
140 |
141 | + (JMODevicePowerInfos *)jmo_devicePowerInfos
142 | {
143 | return [JMODevicePowerInfos infosForDeviceModelNamed:[self jmo_modelName]];
144 | }
145 |
146 | @end
147 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/0_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/0_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/10_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/10_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/1_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/1_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/2_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/2_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/3_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/3_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/4_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/4_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/5_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/5_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/6_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/6_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/7_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/7_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/8_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/8_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/9_verge_super_wide.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/VergePhotos/9_verge_super_wide.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/gifs/Rotating_earth.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/gifs/Rotating_earth.gif
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/gifs/nyan.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/gifs/nyan.gif
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/gifs/rock.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/gifs/rock.gif
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_0.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_1.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_10.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_11.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_12.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_13.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_14.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_14.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_15.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_15.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_16.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_16.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_17.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_17.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_18.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_18.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_19.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_19.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_2.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_20.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_20.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_21.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_21.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_22.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_22.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_23.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_23.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_24.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_24.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_25.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_25.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_26.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_26.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_27.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_27.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_28.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_28.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_29.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_29.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_3.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_30.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_30.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_31.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_31.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_32.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_32.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_33.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_33.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_34.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_34.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_35.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_35.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_36.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_36.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_37.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_37.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_38.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_38.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_39.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_39.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_4.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_40.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_40.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_41.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_41.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_42.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_42.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_43.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_43.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_44.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_44.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_45.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_45.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_46.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_46.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_47.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_47.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_48.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_48.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_49.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_49.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_5.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_50.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_50.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_51.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_51.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_52.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_52.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_53.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_53.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_54.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_54.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_55.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_55.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_56.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_56.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_57.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_57.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_58.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_58.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_59.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_59.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_6.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_60.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_60.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_61.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_61.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_62.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_62.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_63.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_63.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_64.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_64.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_65.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_65.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_66.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_66.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_67.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_67.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_68.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_68.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_69.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_69.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_7.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_70.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_70.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_71.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_71.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_72.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_72.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_8.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/JMAnimatedImageView/JMAnimatedImageView/images/zoom_1920_9.jpg
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageView/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // JMAnimatedImageView
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "JMAppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([JMAppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageViewTests/JMAnimatedImageViewTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.morissard.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageViewTests/JMAnimatedImageViewTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // JMAnimatedImageViewTests.m
3 | // JMAnimatedImageViewTests
4 | //
5 | // Created by jerome morissard on 15/08/14.
6 | // Copyright (c) 2014 jerome morissard. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface JMAnimatedImageViewTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation JMAnimatedImageViewTests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/JMAnimatedImageView/JMAnimatedImageViewTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/LICENCE:
--------------------------------------------------------------------------------
1 | //
2 | // The MIT License (MIT)
3 | //
4 | // Copyright (c) 2014 Morissard
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## My other works
2 |
3 | [http://leverdeterre.github.io] (http://leverdeterre.github.io)
4 |
5 | JMAnimatedImageView
6 | ==================
7 |
8 | JMAnimatedImageView is a performant subclass of UIImageView:
9 |
10 | - Plays huge image animation using a minimum memory pressure,
11 | - Allows manual interactions with imageView to drive manualy animations,
12 | - Can use has a Carousel,
13 | - GIF are supported to load your animations.
14 |
15 | ## Change Log
16 |
17 | 0.2.4 :
18 |
19 | - Improve documentation
20 | - Fix retain cycle (Thanks Instruments!)
21 | - JMGif allocation for a better integration with your favorites network libraries.
22 |
23 |
24 | ## Installation
25 |
26 | Simply replace your `UIImageView` instances with instances of `JMAnimatedImageView`.
27 |
28 | If using CocoaPods, the quickest way to try it out is to type this on the command line:
29 |
30 | ```shell
31 | $ pod try JMAnimatedImageView
32 | ```
33 |
34 | ## Usage
35 | ### For a local animation using file from a bundle
36 |
37 | In your code, `#import "JMAnimatedImageView.h"` and `#import "JMAnimatedImageView.h"`
38 |
39 | ```objective-c
40 | //GIF example
41 | @property (weak, nonatomic) IBOutlet JMAnimatedImageView *jmImageView;
42 |
43 | [self.jmImageView reloadAnimationImagesFromGifNamed:@"rock"];
44 | self.jmImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
45 | [self.jmImageView startAnimating];
46 | ```
47 |
48 | ```objective-c
49 | //PNG example with manual animation
50 | @property (weak, nonatomic) IBOutlet JMAnimatedImageView *jmImageView;
51 |
52 | self.jmImageView.animationDelegate = self;
53 | self.jmImageView.animationDatasource = self;
54 | [self.jmImageView reloadAnimationImages]; //
55 | self.jmImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
56 | self.jmImageView.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
57 | [self.jmImageView startAnimating];
58 | ```
59 |
60 | ### For a remote Gif
61 |
62 | ```objective-c
63 | @property (weak, nonatomic) IBOutlet JMAnimatedImageView *jmImageView;
64 |
65 | [[JMApi sharedApi] downloadYourGifFileHasData:^(NSData *gifData) {
66 | self.animatedImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
67 | self.animatedImageView.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
68 | [self.animatedImageView reloadAnimationImagesFromGifData:gifData fromUrl:url];
69 | [self.animatedImageView startAnimating];
70 | }];
71 | ```
72 | ### For a remote Gif using AFNetworking
73 |
74 | ```objective-c
75 | NSURLRequest *req = [NSURLRequest requestWithURL:url];
76 |
77 | AFHTTPRequestOperation *postOperation = [[AFHTTPRequestOperation alloc] initWithRequest:req];
78 | [postOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
79 | self.animatedImageView.animationType = JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition;
80 | self.animatedImageView.memoryManagementOption = JMAnimatedImageViewMemoryLoadImageLowMemoryUsage;
81 | [self.animatedImageView reloadAnimationImagesFromGifData:responseObject fromUrl:url];
82 | [self.animatedImageView startAnimating];
83 |
84 | } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
85 | NSLog(@"Image error: %@", error);
86 | block(NO, nil);
87 | }];
88 |
89 | [postOperation start];
90 | ```
91 |
92 | ### Customizations
93 |
94 | * AnimationType
95 |
96 | ```objective-c
97 | typedef NS_ENUM(NSUInteger, JMAnimatedImageViewAnimationType) {
98 | JMAnimatedImageViewAnimationTypeInteractive = 0,
99 |
100 | //Animation, carousel effect
101 | JMAnimatedImageViewAnimationTypeManualSwipe,
102 |
103 | //Automatic rotation, use animationDuration + animationRepeatCount
104 | JMAnimatedImageViewAnimationTypeAutomaticLinear,
105 | JMAnimatedImageViewAnimationTypeAutomaticLinearWithoutTransition,
106 | JMAnimatedImageViewAnimationTypeAutomaticReverse,
107 | };
108 | ```
109 |
110 | * MemoryOption
111 |
112 | ```objective-c
113 | typedef NS_ENUM(NSUInteger, JMAnimatedImageViewMemoryOption) {
114 | JMAnimatedImageViewMemoryLoadImageSystemCache = 0, //images memory will be retain by system
115 | JMAnimatedImageViewMemoryLoadImageLowMemoryUsage, //images loaded but not retained by the system
116 | JMAnimatedImageViewMemoryLoadImageCustom //images loaded by you (JMOImageViewAnimationDatasource)
117 | };
118 | ```
119 |
120 | * ImageViewOrder
121 |
122 | ```objective-c
123 | typedef NS_ENUM(NSUInteger, JMAnimatedImageViewOrder) {
124 | JMAnimatedImageViewOrderNormal = 1,
125 | JMAnimatedImageViewOrderReverse = -1
126 | };
127 | ```
128 |
129 | ## Multi Gif and animation type (top interactive, leff automatic swipe effect, right automatic without animation)
130 |
131 | 
132 |
133 | ## JMimageView can generate Carousels
134 |
135 | 
136 |
137 | ## JMimageView allows interactive animations
138 |
139 | 
140 |
141 | ## TODO
142 | * Add support for APNG
143 | * Add support for WebP animated (work in progress but this feature is not actually supported : https://chromium.googlesource.com/webm/libwebp/)
144 | * * Add support for video format ?
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/Screens/JMImageViewCarousel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/Screens/JMImageViewCarousel.png
--------------------------------------------------------------------------------
/Screens/JMImageViewRotation.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/Screens/JMImageViewRotation.gif
--------------------------------------------------------------------------------
/Screens/JMimageViewCarousel.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/Screens/JMimageViewCarousel.gif
--------------------------------------------------------------------------------
/Screens/gif_experiments.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leverdeterre/JMAnimatedImageView/fd70e549ff87ac014f6906d53e48e7197d336259/Screens/gif_experiments.gif
--------------------------------------------------------------------------------