huangyirong 4 years ago
parent
commit
0da6be05aa

BIN
SDWebImage/FLAnimatedImageView.jpg


File diff suppressed because it is too large
+ 51 - 9
SDWebImage/SDWebImage学习之GIF加载.md


+ 23 - 0
TestGIF/Podfile

@@ -0,0 +1,23 @@
+# Uncomment the next line to define a global platform for your project
+# platform :ios, '9.0'
+source 'http://gerrit.sogou/SeMob_PodsSpecs'
+
+target 'TestGIF' do
+  # Comment the next line if you don't want to use dynamic frameworks
+  use_modular_headers!
+
+  # Pods for TestGIF
+
+  pod 'SeMob_SDWebImage', '4.4.6.3'
+
+  target 'TestGIFTests' do
+    inherit! :search_paths
+    # Pods for testing
+  end
+
+  target 'TestGIFUITests' do
+    inherit! :search_paths
+    # Pods for testing
+  end
+
+end

+ 596 - 0
TestGIF/TestGIF.xcodeproj/project.pbxproj

@@ -0,0 +1,596 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 50;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		4035794B2486A6680077F927 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4035794A2486A6680077F927 /* AppDelegate.m */; };
+		4035794E2486A6680077F927 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4035794D2486A6680077F927 /* SceneDelegate.m */; };
+		403579512486A6680077F927 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 403579502486A6680077F927 /* ViewController.m */; };
+		403579542486A6680077F927 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 403579522486A6680077F927 /* Main.storyboard */; };
+		403579562486A6690077F927 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 403579552486A6690077F927 /* Assets.xcassets */; };
+		403579592486A6690077F927 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 403579572486A6690077F927 /* LaunchScreen.storyboard */; };
+		4035795C2486A6690077F927 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4035795B2486A6690077F927 /* main.m */; };
+		403579662486A6690077F927 /* TestGIFTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 403579652486A6690077F927 /* TestGIFTests.m */; };
+		403579712486A6690077F927 /* TestGIFUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 403579702486A6690077F927 /* TestGIFUITests.m */; };
+		403579802486A71C0077F927 /* SeMobGIFImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4035797E2486A71C0077F927 /* SeMobGIFImageView.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		403579622486A6690077F927 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 4035793E2486A6680077F927 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 403579452486A6680077F927;
+			remoteInfo = TestGIF;
+		};
+		4035796D2486A6690077F927 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 4035793E2486A6680077F927 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 403579452486A6680077F927;
+			remoteInfo = TestGIF;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		403579462486A6680077F927 /* TestGIF.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestGIF.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		403579492486A6680077F927 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+		4035794A2486A6680077F927 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+		4035794C2486A6680077F927 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; };
+		4035794D2486A6680077F927 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; };
+		4035794F2486A6680077F927 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
+		403579502486A6680077F927 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
+		403579532486A6680077F927 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+		403579552486A6690077F927 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+		403579582486A6690077F927 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+		4035795A2486A6690077F927 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		4035795B2486A6690077F927 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+		403579612486A6690077F927 /* TestGIFTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestGIFTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+		403579652486A6690077F927 /* TestGIFTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestGIFTests.m; sourceTree = "<group>"; };
+		403579672486A6690077F927 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		4035796C2486A6690077F927 /* TestGIFUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestGIFUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+		403579702486A6690077F927 /* TestGIFUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestGIFUITests.m; sourceTree = "<group>"; };
+		403579722486A6690077F927 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		4035797E2486A71C0077F927 /* SeMobGIFImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SeMobGIFImageView.m; sourceTree = "<group>"; };
+		4035797F2486A71C0077F927 /* SeMobGIFImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SeMobGIFImageView.h; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		403579432486A6680077F927 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4035795E2486A6690077F927 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		403579692486A6690077F927 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		4035793D2486A6680077F927 = {
+			isa = PBXGroup;
+			children = (
+				403579482486A6680077F927 /* TestGIF */,
+				403579642486A6690077F927 /* TestGIFTests */,
+				4035796F2486A6690077F927 /* TestGIFUITests */,
+				403579472486A6680077F927 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		403579472486A6680077F927 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				403579462486A6680077F927 /* TestGIF.app */,
+				403579612486A6690077F927 /* TestGIFTests.xctest */,
+				4035796C2486A6690077F927 /* TestGIFUITests.xctest */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		403579482486A6680077F927 /* TestGIF */ = {
+			isa = PBXGroup;
+			children = (
+				403579492486A6680077F927 /* AppDelegate.h */,
+				4035794A2486A6680077F927 /* AppDelegate.m */,
+				4035794C2486A6680077F927 /* SceneDelegate.h */,
+				4035794D2486A6680077F927 /* SceneDelegate.m */,
+				4035794F2486A6680077F927 /* ViewController.h */,
+				403579502486A6680077F927 /* ViewController.m */,
+				4035797F2486A71C0077F927 /* SeMobGIFImageView.h */,
+				4035797E2486A71C0077F927 /* SeMobGIFImageView.m */,
+				403579522486A6680077F927 /* Main.storyboard */,
+				403579552486A6690077F927 /* Assets.xcassets */,
+				403579572486A6690077F927 /* LaunchScreen.storyboard */,
+				4035795A2486A6690077F927 /* Info.plist */,
+				4035795B2486A6690077F927 /* main.m */,
+			);
+			path = TestGIF;
+			sourceTree = "<group>";
+		};
+		403579642486A6690077F927 /* TestGIFTests */ = {
+			isa = PBXGroup;
+			children = (
+				403579652486A6690077F927 /* TestGIFTests.m */,
+				403579672486A6690077F927 /* Info.plist */,
+			);
+			path = TestGIFTests;
+			sourceTree = "<group>";
+		};
+		4035796F2486A6690077F927 /* TestGIFUITests */ = {
+			isa = PBXGroup;
+			children = (
+				403579702486A6690077F927 /* TestGIFUITests.m */,
+				403579722486A6690077F927 /* Info.plist */,
+			);
+			path = TestGIFUITests;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		403579452486A6680077F927 /* TestGIF */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 403579752486A6690077F927 /* Build configuration list for PBXNativeTarget "TestGIF" */;
+			buildPhases = (
+				403579422486A6680077F927 /* Sources */,
+				403579432486A6680077F927 /* Frameworks */,
+				403579442486A6680077F927 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = TestGIF;
+			productName = TestGIF;
+			productReference = 403579462486A6680077F927 /* TestGIF.app */;
+			productType = "com.apple.product-type.application";
+		};
+		403579602486A6690077F927 /* TestGIFTests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 403579782486A6690077F927 /* Build configuration list for PBXNativeTarget "TestGIFTests" */;
+			buildPhases = (
+				4035795D2486A6690077F927 /* Sources */,
+				4035795E2486A6690077F927 /* Frameworks */,
+				4035795F2486A6690077F927 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				403579632486A6690077F927 /* PBXTargetDependency */,
+			);
+			name = TestGIFTests;
+			productName = TestGIFTests;
+			productReference = 403579612486A6690077F927 /* TestGIFTests.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
+		};
+		4035796B2486A6690077F927 /* TestGIFUITests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4035797B2486A6690077F927 /* Build configuration list for PBXNativeTarget "TestGIFUITests" */;
+			buildPhases = (
+				403579682486A6690077F927 /* Sources */,
+				403579692486A6690077F927 /* Frameworks */,
+				4035796A2486A6690077F927 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				4035796E2486A6690077F927 /* PBXTargetDependency */,
+			);
+			name = TestGIFUITests;
+			productName = TestGIFUITests;
+			productReference = 4035796C2486A6690077F927 /* TestGIFUITests.xctest */;
+			productType = "com.apple.product-type.bundle.ui-testing";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		4035793E2486A6680077F927 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 1130;
+				ORGANIZATIONNAME = Sogou;
+				TargetAttributes = {
+					403579452486A6680077F927 = {
+						CreatedOnToolsVersion = 11.3.1;
+					};
+					403579602486A6690077F927 = {
+						CreatedOnToolsVersion = 11.3.1;
+						TestTargetID = 403579452486A6680077F927;
+					};
+					4035796B2486A6690077F927 = {
+						CreatedOnToolsVersion = 11.3.1;
+						TestTargetID = 403579452486A6680077F927;
+					};
+				};
+			};
+			buildConfigurationList = 403579412486A6680077F927 /* Build configuration list for PBXProject "TestGIF" */;
+			compatibilityVersion = "Xcode 9.3";
+			developmentRegion = en;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+				Base,
+			);
+			mainGroup = 4035793D2486A6680077F927;
+			productRefGroup = 403579472486A6680077F927 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				403579452486A6680077F927 /* TestGIF */,
+				403579602486A6690077F927 /* TestGIFTests */,
+				4035796B2486A6690077F927 /* TestGIFUITests */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		403579442486A6680077F927 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				403579592486A6690077F927 /* LaunchScreen.storyboard in Resources */,
+				403579562486A6690077F927 /* Assets.xcassets in Resources */,
+				403579542486A6680077F927 /* Main.storyboard in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4035795F2486A6690077F927 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4035796A2486A6690077F927 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		403579422486A6680077F927 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				403579512486A6680077F927 /* ViewController.m in Sources */,
+				4035794B2486A6680077F927 /* AppDelegate.m in Sources */,
+				4035795C2486A6690077F927 /* main.m in Sources */,
+				403579802486A71C0077F927 /* SeMobGIFImageView.m in Sources */,
+				4035794E2486A6680077F927 /* SceneDelegate.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		4035795D2486A6690077F927 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				403579662486A6690077F927 /* TestGIFTests.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		403579682486A6690077F927 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				403579712486A6690077F927 /* TestGIFUITests.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		403579632486A6690077F927 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 403579452486A6680077F927 /* TestGIF */;
+			targetProxy = 403579622486A6690077F927 /* PBXContainerItemProxy */;
+		};
+		4035796E2486A6690077F927 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 403579452486A6680077F927 /* TestGIF */;
+			targetProxy = 4035796D2486A6690077F927 /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+		403579522486A6680077F927 /* Main.storyboard */ = {
+			isa = PBXVariantGroup;
+			children = (
+				403579532486A6680077F927 /* Base */,
+			);
+			name = Main.storyboard;
+			sourceTree = "<group>";
+		};
+		403579572486A6690077F927 /* LaunchScreen.storyboard */ = {
+			isa = PBXVariantGroup;
+			children = (
+				403579582486A6690077F927 /* Base */,
+			);
+			name = LaunchScreen.storyboard;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+		403579732486A6690077F927 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_TESTABILITY = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+				MTL_FAST_MATH = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = iphoneos;
+			};
+			name = Debug;
+		};
+		403579742486A6690077F927 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+				MTL_ENABLE_DEBUG_INFO = NO;
+				MTL_FAST_MATH = YES;
+				SDKROOT = iphoneos;
+				VALIDATE_PRODUCT = YES;
+			};
+			name = Release;
+		};
+		403579762486A6690077F927 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = ZQJ4SDDLY2;
+				INFOPLIST_FILE = TestGIF/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = Sogou.TestGIF;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Debug;
+		};
+		403579772486A6690077F927 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = ZQJ4SDDLY2;
+				INFOPLIST_FILE = TestGIF/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = Sogou.TestGIF;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Release;
+		};
+		403579792486A6690077F927 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				BUNDLE_LOADER = "$(TEST_HOST)";
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = ZQJ4SDDLY2;
+				INFOPLIST_FILE = TestGIFTests/Info.plist;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = Sogou.TestGIFTests;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TARGETED_DEVICE_FAMILY = "1,2";
+				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestGIF.app/TestGIF";
+			};
+			name = Debug;
+		};
+		4035797A2486A6690077F927 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				BUNDLE_LOADER = "$(TEST_HOST)";
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = ZQJ4SDDLY2;
+				INFOPLIST_FILE = TestGIFTests/Info.plist;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = Sogou.TestGIFTests;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TARGETED_DEVICE_FAMILY = "1,2";
+				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestGIF.app/TestGIF";
+			};
+			name = Release;
+		};
+		4035797C2486A6690077F927 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = ZQJ4SDDLY2;
+				INFOPLIST_FILE = TestGIFUITests/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = Sogou.TestGIFUITests;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TARGETED_DEVICE_FAMILY = "1,2";
+				TEST_TARGET_NAME = TestGIF;
+			};
+			name = Debug;
+		};
+		4035797D2486A6690077F927 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = ZQJ4SDDLY2;
+				INFOPLIST_FILE = TestGIFUITests/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@loader_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = Sogou.TestGIFUITests;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TARGETED_DEVICE_FAMILY = "1,2";
+				TEST_TARGET_NAME = TestGIF;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		403579412486A6680077F927 /* Build configuration list for PBXProject "TestGIF" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				403579732486A6690077F927 /* Debug */,
+				403579742486A6690077F927 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		403579752486A6690077F927 /* Build configuration list for PBXNativeTarget "TestGIF" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				403579762486A6690077F927 /* Debug */,
+				403579772486A6690077F927 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		403579782486A6690077F927 /* Build configuration list for PBXNativeTarget "TestGIFTests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				403579792486A6690077F927 /* Debug */,
+				4035797A2486A6690077F927 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		4035797B2486A6690077F927 /* Build configuration list for PBXNativeTarget "TestGIFUITests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4035797C2486A6690077F927 /* Debug */,
+				4035797D2486A6690077F927 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 4035793E2486A6680077F927 /* Project object */;
+}

+ 7 - 0
TestGIF/TestGIF.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:TestGIF.xcodeproj">
+   </FileRef>
+</Workspace>

+ 8 - 0
TestGIF/TestGIF.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IDEDidComputeMac32BitWarning</key>
+	<true/>
+</dict>
+</plist>

+ 15 - 0
TestGIF/TestGIF/AppDelegate.h

@@ -0,0 +1,15 @@
+//
+//  AppDelegate.h
+//  TestGIF
+//
+//  Created by huangyirong on 2020/6/2.
+//  Copyright © 2020 Sogou. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+
+@end
+

+ 41 - 0
TestGIF/TestGIF/AppDelegate.m

@@ -0,0 +1,41 @@
+//
+//  AppDelegate.m
+//  TestGIF
+//
+//  Created by huangyirong on 2020/6/2.
+//  Copyright © 2020 Sogou. All rights reserved.
+//
+
+#import "AppDelegate.h"
+
+@interface AppDelegate ()
+
+@end
+
+@implementation AppDelegate
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+    // Override point for customization after application launch.
+    return YES;
+}
+
+
+#pragma mark - UISceneSession lifecycle
+
+
+- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
+    // Called when a new scene session is being created.
+    // Use this method to select a configuration to create the new scene with.
+    return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
+}
+
+
+- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
+    // Called when the user discards a scene session.
+    // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
+    // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
+}
+
+
+@end

+ 98 - 0
TestGIF/TestGIF/Assets.xcassets/AppIcon.appiconset/Contents.json

@@ -0,0 +1,98 @@
+{
+  "images" : [
+    {
+      "idiom" : "iphone",
+      "size" : "20x20",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "20x20",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "29x29",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "29x29",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "40x40",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "40x40",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "60x60",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "60x60",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "20x20",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "20x20",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "29x29",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "29x29",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "40x40",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "40x40",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "76x76",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "76x76",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "83.5x83.5",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ios-marketing",
+      "size" : "1024x1024",
+      "scale" : "1x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 6 - 0
TestGIF/TestGIF/Assets.xcassets/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 25 - 0
TestGIF/TestGIF/Base.lproj/LaunchScreen.storyboard

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--View Controller-->
+        <scene sceneID="EHf-IW-A2E">
+            <objects>
+                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+                        <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
+                    </view>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="53" y="375"/>
+        </scene>
+    </scenes>
+</document>

+ 24 - 0
TestGIF/TestGIF/Base.lproj/Main.storyboard

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--View Controller-->
+        <scene sceneID="tne-QT-ifu">
+            <objects>
+                <viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+                        <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
+                    </view>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
+            </objects>
+        </scene>
+    </scenes>
+</document>

+ 64 - 0
TestGIF/TestGIF/Info.plist

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>$(DEVELOPMENT_LANGUAGE)</string>
+	<key>CFBundleExecutable</key>
+	<string>$(EXECUTABLE_NAME)</string>
+	<key>CFBundleIdentifier</key>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>$(PRODUCT_NAME)</string>
+	<key>CFBundlePackageType</key>
+	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+	<key>LSRequiresIPhoneOS</key>
+	<true/>
+	<key>UIApplicationSceneManifest</key>
+	<dict>
+		<key>UIApplicationSupportsMultipleScenes</key>
+		<false/>
+		<key>UISceneConfigurations</key>
+		<dict>
+			<key>UIWindowSceneSessionRoleApplication</key>
+			<array>
+				<dict>
+					<key>UISceneConfigurationName</key>
+					<string>Default Configuration</string>
+					<key>UISceneDelegateClassName</key>
+					<string>SceneDelegate</string>
+					<key>UISceneStoryboardFile</key>
+					<string>Main</string>
+				</dict>
+			</array>
+		</dict>
+	</dict>
+	<key>UILaunchStoryboardName</key>
+	<string>LaunchScreen</string>
+	<key>UIMainStoryboardFile</key>
+	<string>Main</string>
+	<key>UIRequiredDeviceCapabilities</key>
+	<array>
+		<string>armv7</string>
+	</array>
+	<key>UISupportedInterfaceOrientations</key>
+	<array>
+		<string>UIInterfaceOrientationPortrait</string>
+		<string>UIInterfaceOrientationLandscapeLeft</string>
+		<string>UIInterfaceOrientationLandscapeRight</string>
+	</array>
+	<key>UISupportedInterfaceOrientations~ipad</key>
+	<array>
+		<string>UIInterfaceOrientationPortrait</string>
+		<string>UIInterfaceOrientationPortraitUpsideDown</string>
+		<string>UIInterfaceOrientationLandscapeLeft</string>
+		<string>UIInterfaceOrientationLandscapeRight</string>
+	</array>
+</dict>
+</plist>

+ 16 - 0
TestGIF/TestGIF/SceneDelegate.h

@@ -0,0 +1,16 @@
+//
+//  SceneDelegate.h
+//  TestGIF
+//
+//  Created by huangyirong on 2020/6/2.
+//  Copyright © 2020 Sogou. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
+
+@property (strong, nonatomic) UIWindow * window;
+
+@end
+

+ 50 - 0
TestGIF/TestGIF/SceneDelegate.m

@@ -0,0 +1,50 @@
+#import "SceneDelegate.h"
+
+@interface SceneDelegate ()
+
+@end
+
+@implementation SceneDelegate
+
+
+- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
+    // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
+    // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
+    // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
+}
+
+
+- (void)sceneDidDisconnect:(UIScene *)scene {
+    // Called as the scene is being released by the system.
+    // This occurs shortly after the scene enters the background, or when its session is discarded.
+    // Release any resources associated with this scene that can be re-created the next time the scene connects.
+    // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
+}
+
+
+- (void)sceneDidBecomeActive:(UIScene *)scene {
+    // Called when the scene has moved from an inactive state to an active state.
+    // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
+}
+
+
+- (void)sceneWillResignActive:(UIScene *)scene {
+    // Called when the scene will move from an active state to an inactive state.
+    // This may occur due to temporary interruptions (ex. an incoming phone call).
+}
+
+
+- (void)sceneWillEnterForeground:(UIScene *)scene {
+    // Called as the scene transitions from the background to the foreground.
+    // Use this method to undo the changes made on entering the background.
+}
+
+
+- (void)sceneDidEnterBackground:(UIScene *)scene {
+    // Called as the scene transitions from the foreground to the background.
+    // Use this method to save data, release shared resources, and store enough scene-specific state information
+    // to restore the scene back to its current state.
+}
+
+
+@end

+ 15 - 0
TestGIF/TestGIF/SeMobGIFImageView.h

@@ -0,0 +1,15 @@
+//
+//  SeMobGIFImageView.h
+//  SeMob
+//
+//  Created by yangbin on 2017/8/10.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SeMobGIFImageView : UIImageView
+@property (nonatomic, strong) NSData *gifData;
++ (SeMobGIFImageView *)imageViewWithGIFData:(NSData *)data;
+- (void)startAnimating;
+- (void)stopAnimating;
+@end

+ 134 - 0
TestGIF/TestGIF/SeMobGIFImageView.m

@@ -0,0 +1,134 @@
+//
+//  SeMobGIFImageView.m
+//  SeMob
+//
+//  Created by yangbin on 2017/8/10.
+//
+
+#import "SeMobGIFImageView.h"
+#import <ImageIO/ImageIO.h>
+
+@interface SeMobGIFImageView()
+@property (nonatomic) CGImageSourceRef sourceRef;
+@property (nonatomic) NSUInteger currentIndex;
+@property (nonatomic) NSUInteger maxImageCount;
+
+@end
+@implementation SeMobGIFImageView
+
++ (SeMobGIFImageView *)imageViewWithGIFData:(NSData *)data
+{
+    SeMobGIFImageView *view = [[SeMobGIFImageView alloc] init];
+    view.gifData = data;
+    return view;
+}
+
+- (void)dealloc
+{
+    if (_sourceRef) {
+        CFRelease(_sourceRef);
+    }
+    self.sourceRef = NULL;
+}
+
+- (void)didMoveToWindow
+{
+    if (self.window == nil) {
+        [self stopAnimating];
+    }
+}
+
+- (void)startAnimating
+{
+    [self stopAnimating];
+    if (!_gifData) {
+        return;
+    }
+    _currentIndex = 0;
+    CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)_gifData, NULL);
+    self.sourceRef = source;
+    size_t count = CGImageSourceGetCount(source);
+    self.maxImageCount = count;
+    
+    if (count <= 1) {
+        UIImage *animatedImage = [[UIImage alloc] initWithData:_gifData];
+        self.image = animatedImage;
+        return;
+    } else {
+        [self loadNextImage];
+    }
+}
+
+- (void)stopAnimating
+{
+    if (_sourceRef) {
+        CFRelease(_sourceRef);
+    }
+    self.sourceRef = NULL;
+    self.maxImageCount = 0;
+    self.currentIndex = 0;
+}
+
+- (void)loadNextImage
+{
+    if (_sourceRef == NULL) {
+        return;
+    }
+    CGImageRef image = CGImageSourceCreateImageAtIndex(_sourceRef, _currentIndex, NULL);
+    
+    float duration = [self semobGIF_frameDurationAtIndex:_currentIndex source:_sourceRef];
+    
+    UIImage *imgCurrent = [UIImage imageWithCGImage:image scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp];
+    
+    CGImageRelease(image);
+    self.image = imgCurrent;
+    __weak typeof(self) weakSelf = self;
+    CGImageSourceRef current = _sourceRef;
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        if (weakSelf == nil || weakSelf.sourceRef == NULL) {
+            return ;
+        }
+        if (current != weakSelf.sourceRef) {
+            return;
+        }
+        weakSelf.currentIndex += 1;
+        if (weakSelf.currentIndex >= weakSelf.maxImageCount) {
+            weakSelf.currentIndex = 0;
+        }
+        [weakSelf loadNextImage];
+    });
+}
+
+- (float)semobGIF_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source
+{
+    float frameDuration = 0.1f;
+    CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil);
+    NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties;
+    NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary];
+    
+    NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime];
+    if (delayTimeUnclampedProp) {
+        frameDuration = [delayTimeUnclampedProp floatValue];
+    }
+    else {
+        
+        NSNumber *delayTimeProp = gifProperties[(NSString *)kCGImagePropertyGIFDelayTime];
+        if (delayTimeProp) {
+            frameDuration = [delayTimeProp floatValue];
+        }
+    }
+    
+    // Many annoying ads specify a 0 duration to make an image flash as quickly as possible.
+    // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify
+    // a duration of <= 10 ms. See <rdar://problem/7689300> and <http://webkit.org/b/36082>
+    // for more information.
+    
+    if (frameDuration < 0.011f) {
+        frameDuration = 0.100f;
+    }
+    
+    CFRelease(cfFrameProperties);
+    return frameDuration;
+}
+
+@end

+ 15 - 0
TestGIF/TestGIF/ViewController.h

@@ -0,0 +1,15 @@
+//
+//  ViewController.h
+//  TestGIF
+//
+//  Created by huangyirong on 2020/6/2.
+//  Copyright © 2020 Sogou. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface ViewController : UIViewController
+
+
+@end
+

+ 51 - 0
TestGIF/TestGIF/ViewController.m

@@ -0,0 +1,51 @@
+//
+//  ViewController.m
+//  TestGIF
+//
+//  Created by huangyirong on 2020/6/2.
+//  Copyright © 2020 Sogou. All rights reserved.
+//
+
+#import "ViewController.h"
+@import ImageIO;
+
+@interface ViewController ()
+@property (strong, nonatomic) UIImageView *imageView;
+
+@end
+
+@implementation ViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    [self test1];
+    
+}
+
+- (void)test1
+{
+    _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 200, 200, 200)];
+    [self.view addSubview:_imageView];
+    NSString *path = [[NSBundle mainBundle] pathForResource:@"abc.gif" ofType:nil];
+    NSData *data = [NSData dataWithContentsOfFile:path];
+//   _imageView.image =  [UIImage imageWithData:data];
+//    return;
+    CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
+    NSInteger count = CGImageSourceGetCount(source);
+    NSMutableArray *images = [NSMutableArray arrayWithCapacity:count];
+    for (int i = 0; i < count; i++) {
+       CGImageRef cgImage = CGImageSourceCreateImageAtIndex(source, i, NULL);
+       [images addObject:[UIImage imageWithCGImage:cgImage]];
+       CGImageRelease(cgImage);
+    }
+    CFRelease(source);
+    _imageView.animationImages = images;
+    _imageView.animationDuration = count * 0.1;
+    [_imageView startAnimating];
+}
+
+
+
+
+@end

+ 19 - 0
TestGIF/TestGIF/main.m

@@ -0,0 +1,19 @@
+//
+//  main.m
+//  TestGIF
+//
+//  Created by huangyirong on 2020/6/2.
+//  Copyright © 2020 Sogou. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+    NSString * appDelegateClassName;
+    @autoreleasepool {
+        // Setup code that might create autoreleased objects goes here.
+        appDelegateClassName = NSStringFromClass([AppDelegate class]);
+    }
+    return UIApplicationMain(argc, argv, nil, appDelegateClassName);
+}

+ 22 - 0
TestGIF/TestGIFTests/Info.plist

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>$(DEVELOPMENT_LANGUAGE)</string>
+	<key>CFBundleExecutable</key>
+	<string>$(EXECUTABLE_NAME)</string>
+	<key>CFBundleIdentifier</key>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>$(PRODUCT_NAME)</string>
+	<key>CFBundlePackageType</key>
+	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+</dict>
+</plist>

+ 37 - 0
TestGIF/TestGIFTests/TestGIFTests.m

@@ -0,0 +1,37 @@
+//
+//  TestGIFTests.m
+//  TestGIFTests
+//
+//  Created by huangyirong on 2020/6/2.
+//  Copyright © 2020 Sogou. All rights reserved.
+//
+
+#import <XCTest/XCTest.h>
+
+@interface TestGIFTests : XCTestCase
+
+@end
+
+@implementation TestGIFTests
+
+- (void)setUp {
+    // Put setup code here. This method is called before the invocation of each test method in the class.
+}
+
+- (void)tearDown {
+    // Put teardown code here. This method is called after the invocation of each test method in the class.
+}
+
+- (void)testExample {
+    // This is an example of a functional test case.
+    // Use XCTAssert and related functions to verify your tests produce the correct results.
+}
+
+- (void)testPerformanceExample {
+    // This is an example of a performance test case.
+    [self measureBlock:^{
+        // Put the code you want to measure the time of here.
+    }];
+}
+
+@end

+ 22 - 0
TestGIF/TestGIFUITests/Info.plist

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>$(DEVELOPMENT_LANGUAGE)</string>
+	<key>CFBundleExecutable</key>
+	<string>$(EXECUTABLE_NAME)</string>
+	<key>CFBundleIdentifier</key>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>$(PRODUCT_NAME)</string>
+	<key>CFBundlePackageType</key>
+	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+</dict>
+</plist>

+ 48 - 0
TestGIF/TestGIFUITests/TestGIFUITests.m

@@ -0,0 +1,48 @@
+//
+//  TestGIFUITests.m
+//  TestGIFUITests
+//
+//  Created by huangyirong on 2020/6/2.
+//  Copyright © 2020 Sogou. All rights reserved.
+//
+
+#import <XCTest/XCTest.h>
+
+@interface TestGIFUITests : XCTestCase
+
+@end
+
+@implementation TestGIFUITests
+
+- (void)setUp {
+    // Put setup code here. This method is called before the invocation of each test method in the class.
+
+    // In UI tests it is usually best to stop immediately when a failure occurs.
+    self.continueAfterFailure = NO;
+
+    // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
+}
+
+- (void)tearDown {
+    // Put teardown code here. This method is called after the invocation of each test method in the class.
+}
+
+- (void)testExample {
+    // UI tests must launch the application that they test.
+    XCUIApplication *app = [[XCUIApplication alloc] init];
+    [app launch];
+
+    // Use recording to get started writing UI tests.
+    // Use XCTAssert and related functions to verify your tests produce the correct results.
+}
+
+- (void)testLaunchPerformance {
+    if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
+        // This measures how long it takes to launch your application.
+        [self measureWithMetrics:@[XCTOSSignpostMetric.applicationLaunchMetric] block:^{
+            [[[XCUIApplication alloc] init] launch];
+        }];
+    }
+}
+
+@end