add pods
This commit is contained in:
parent
7e217a4dd7
commit
de0cc0e917
@ -12,12 +12,83 @@
|
||||
916351342C12AFEA00593047 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 916351332C12AFEA00593047 /* main.m */; };
|
||||
916351402C12B12F00593047 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163513F2C12B12F00593047 /* AppDelegate.m */; };
|
||||
916351432C12B13700593047 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 916351422C12B13700593047 /* SceneDelegate.m */; };
|
||||
AC39FB6C929D30EFDAAC6CEB /* Pods_HiBit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7603423F984179550EE5476E /* Pods_HiBit.framework */; };
|
||||
916352F62C12B6D400593047 /* FoundationContainer+Log.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352472C12B6D400593047 /* FoundationContainer+Log.m */; };
|
||||
916352F72C12B6D400593047 /* NSData+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163524A2C12B6D400593047 /* NSData+Extension.m */; };
|
||||
916352F82C12B6D400593047 /* NSDate+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163524D2C12B6D400593047 /* NSDate+Extension.m */; };
|
||||
916352F92C12B6D400593047 /* NSDictionary+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352502C12B6D400593047 /* NSDictionary+Extension.m */; };
|
||||
916352FA2C12B6D400593047 /* NSNumber+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352532C12B6D400593047 /* NSNumber+Extension.m */; };
|
||||
916352FB2C12B6D400593047 /* NSObject+countDown.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352562C12B6D400593047 /* NSObject+countDown.m */; };
|
||||
916352FC2C12B6D400593047 /* NSObject+Swizzled.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352582C12B6D400593047 /* NSObject+Swizzled.m */; };
|
||||
916352FD2C12B6D400593047 /* NSObject+Tool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163525A2C12B6D400593047 /* NSObject+Tool.m */; };
|
||||
916352FE2C12B6D400593047 /* NSString+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163525D2C12B6D400593047 /* NSString+Extension.m */; };
|
||||
916352FF2C12B6D400593047 /* NSString+Tools.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163525F2C12B6D400593047 /* NSString+Tools.m */; };
|
||||
916353002C12B6D400593047 /* NSUserDefaults+Extesion.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352622C12B6D400593047 /* NSUserDefaults+Extesion.m */; };
|
||||
916353012C12B6D400593047 /* UIColor+Category.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352652C12B6D400593047 /* UIColor+Category.m */; };
|
||||
916353022C12B6D400593047 /* UIControl+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352682C12B6D400593047 /* UIControl+Extension.m */; };
|
||||
916353032C12B6D400593047 /* UIDevice+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163526B2C12B6D400593047 /* UIDevice+Extension.m */; };
|
||||
916353042C12B6D400593047 /* UIFont+Category.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163526E2C12B6D400593047 /* UIFont+Category.m */; };
|
||||
916353052C12B6D400593047 /* UIImage+Category.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352712C12B6D400593047 /* UIImage+Category.m */; };
|
||||
916353062C12B6D400593047 /* UIImageView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352742C12B6D400593047 /* UIImageView+Extension.m */; };
|
||||
916353072C12B6D400593047 /* UIScreen+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352772C12B6D400593047 /* UIScreen+Extension.m */; };
|
||||
916353082C12B6D400593047 /* UITableView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163527A2C12B6D400593047 /* UITableView+Extension.m */; };
|
||||
916353092C12B6D400593047 /* UITextField+Category.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163527D2C12B6D400593047 /* UITextField+Category.m */; };
|
||||
9163530A2C12B6D400593047 /* NSLayoutConstraint+BSIBDesignable.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352802C12B6D400593047 /* NSLayoutConstraint+BSIBDesignable.m */; };
|
||||
9163530B2C12B6D400593047 /* UIView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352822C12B6D400593047 /* UIView+Extension.m */; };
|
||||
9163530C2C12B6D400593047 /* UIView+Frame.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352842C12B6D400593047 /* UIView+Frame.m */; };
|
||||
9163530D2C12B6D400593047 /* UINavigationController+Transparent.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352872C12B6D400593047 /* UINavigationController+Transparent.m */; };
|
||||
9163530E2C12B6D400593047 /* UIViewController+present.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352892C12B6D400593047 /* UIViewController+present.m */; };
|
||||
9163530F2C12B6D400593047 /* GTMBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163528D2C12B6D400593047 /* GTMBase64.m */; };
|
||||
916353102C12B6D400593047 /* NSString+AES.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352902C12B6D400593047 /* NSString+AES.m */; };
|
||||
916353112C12B6D400593047 /* DGActivityIndicatorAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352932C12B6D400593047 /* DGActivityIndicatorAnimation.m */; };
|
||||
916353122C12B6D400593047 /* DGActivityIndicatorBallBeatAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352952C12B6D400593047 /* DGActivityIndicatorBallBeatAnimation.m */; };
|
||||
916353132C12B6D400593047 /* DGActivityIndicatorBallClipRotateAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352972C12B6D400593047 /* DGActivityIndicatorBallClipRotateAnimation.m */; };
|
||||
916353142C12B6D400593047 /* DGActivityIndicatorBallClipRotateMultipleAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352992C12B6D400593047 /* DGActivityIndicatorBallClipRotateMultipleAnimation.m */; };
|
||||
916353152C12B6D400593047 /* DGActivityIndicatorBallClipRotatePulseAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163529B2C12B6D400593047 /* DGActivityIndicatorBallClipRotatePulseAnimation.m */; };
|
||||
916353162C12B6D400593047 /* DGActivityIndicatorBallGridBeatAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163529D2C12B6D400593047 /* DGActivityIndicatorBallGridBeatAnimation.m */; };
|
||||
916353172C12B6D400593047 /* DGActivityIndicatorBallGridPulseAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163529F2C12B6D400593047 /* DGActivityIndicatorBallGridPulseAnimation.m */; };
|
||||
916353182C12B6D400593047 /* DGActivityIndicatorBallPulseAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352A12C12B6D400593047 /* DGActivityIndicatorBallPulseAnimation.m */; };
|
||||
916353192C12B6D400593047 /* DGActivityIndicatorBallPulseSyncAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352A32C12B6D400593047 /* DGActivityIndicatorBallPulseSyncAnimation.m */; };
|
||||
9163531A2C12B6D400593047 /* DGActivityIndicatorBallRotateAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352A52C12B6D400593047 /* DGActivityIndicatorBallRotateAnimation.m */; };
|
||||
9163531B2C12B6D400593047 /* DGActivityIndicatorBallScaleAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352A72C12B6D400593047 /* DGActivityIndicatorBallScaleAnimation.m */; };
|
||||
9163531C2C12B6D400593047 /* DGActivityIndicatorBallScaleMultipleAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352A92C12B6D400593047 /* DGActivityIndicatorBallScaleMultipleAnimation.m */; };
|
||||
9163531D2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352AB2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleAnimation.m */; };
|
||||
9163531E2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleMultipleAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352AD2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleMultipleAnimation.m */; };
|
||||
9163531F2C12B6D400593047 /* DGActivityIndicatorBallSpinFadeLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352AF2C12B6D400593047 /* DGActivityIndicatorBallSpinFadeLoader.m */; };
|
||||
916353202C12B6D400593047 /* DGActivityIndicatorBallTrianglePathAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352B12C12B6D400593047 /* DGActivityIndicatorBallTrianglePathAnimation.m */; };
|
||||
916353212C12B6D400593047 /* DGActivityIndicatorBallZigZagAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352B32C12B6D400593047 /* DGActivityIndicatorBallZigZagAnimation.m */; };
|
||||
916353222C12B6D400593047 /* DGActivityIndicatorBallZigZagDeflectAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352B52C12B6D400593047 /* DGActivityIndicatorBallZigZagDeflectAnimation.m */; };
|
||||
916353232C12B6D400593047 /* DGActivityIndicatorCookieTerminatorAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352B72C12B6D400593047 /* DGActivityIndicatorCookieTerminatorAnimation.m */; };
|
||||
916353242C12B6D400593047 /* DGActivityIndicatorDoubleBounceAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352B92C12B6D400593047 /* DGActivityIndicatorDoubleBounceAnimation.m */; };
|
||||
916353252C12B6D400593047 /* DGActivityIndicatorFiveDotsAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352BB2C12B6D400593047 /* DGActivityIndicatorFiveDotsAnimation.m */; };
|
||||
916353262C12B6D400593047 /* DGActivityIndicatorLineScaleAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352BD2C12B6D400593047 /* DGActivityIndicatorLineScaleAnimation.m */; };
|
||||
916353272C12B6D400593047 /* DGActivityIndicatorLineScalePartyAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352BF2C12B6D400593047 /* DGActivityIndicatorLineScalePartyAnimation.m */; };
|
||||
916353282C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352C12C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutAnimation.m */; };
|
||||
916353292C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutRapidAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352C32C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutRapidAnimation.m */; };
|
||||
9163532A2C12B6D400593047 /* DGActivityIndicatorNineDotsAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352C52C12B6D400593047 /* DGActivityIndicatorNineDotsAnimation.m */; };
|
||||
9163532B2C12B6D400593047 /* DGActivityIndicatorRotatingSandglassAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352C72C12B6D400593047 /* DGActivityIndicatorRotatingSandglassAnimation.m */; };
|
||||
9163532C2C12B6D400593047 /* DGActivityIndicatorRotatingSquaresAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352C92C12B6D400593047 /* DGActivityIndicatorRotatingSquaresAnimation.m */; };
|
||||
9163532D2C12B6D400593047 /* DGActivityIndicatorRotatingTrigonAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352CB2C12B6D400593047 /* DGActivityIndicatorRotatingTrigonAnimation.m */; };
|
||||
9163532E2C12B6D400593047 /* DGActivityIndicatorThreeDotsAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352CD2C12B6D400593047 /* DGActivityIndicatorThreeDotsAnimation.m */; };
|
||||
9163532F2C12B6D400593047 /* DGActivityIndicatorTriangleSkewSpinAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352CF2C12B6D400593047 /* DGActivityIndicatorTriangleSkewSpinAnimation.m */; };
|
||||
916353302C12B6D400593047 /* DGActivityIndicatorTriplePulseAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352D12C12B6D400593047 /* DGActivityIndicatorTriplePulseAnimation.m */; };
|
||||
916353312C12B6D400593047 /* DGActivityIndicatorTripleRingsAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352D32C12B6D400593047 /* DGActivityIndicatorTripleRingsAnimation.m */; };
|
||||
916353322C12B6D400593047 /* DGActivityIndicatorTwoDotsAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352D52C12B6D400593047 /* DGActivityIndicatorTwoDotsAnimation.m */; };
|
||||
916353332C12B6D400593047 /* DGActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352D92C12B6D400593047 /* DGActivityIndicatorView.m */; };
|
||||
916353342C12B6D400593047 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352DC2C12B6D400593047 /* MBProgressHUD.m */; };
|
||||
916353352C12B6D400593047 /* SVIndefiniteAnimatedView.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352DF2C12B6D400593047 /* SVIndefiniteAnimatedView.m */; };
|
||||
916353362C12B6D400593047 /* SVProgressAnimatedView.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352E12C12B6D400593047 /* SVProgressAnimatedView.m */; };
|
||||
916353372C12B6D400593047 /* SVProgressHUD.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 916352E32C12B6D400593047 /* SVProgressHUD.bundle */; };
|
||||
916353382C12B6D400593047 /* SVProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352E52C12B6D400593047 /* SVProgressHUD.m */; };
|
||||
916353392C12B6D400593047 /* SVRadialGradientLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352E72C12B6D400593047 /* SVRadialGradientLayer.m */; };
|
||||
9163533A2C12B6D400593047 /* HUDManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352EA2C12B6D400593047 /* HUDManager.m */; };
|
||||
9163533D2C12B6D400593047 /* KxMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352F02C12B6D400593047 /* KxMenu.m */; };
|
||||
9163533E2C12B6D400593047 /* QJNetWorking.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352F32C12B6D400593047 /* QJNetWorking.m */; };
|
||||
C8AC2283D47E2B99FF559E75 /* libPods-HiBit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 141F02EF5C0783797594009A /* libPods-HiBit.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
141F02EF5C0783797594009A /* libPods-HiBit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HiBit.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1B0AEA883685A7D77ED99F7E /* Pods-HiBit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HiBit.release.xcconfig"; path = "Target Support Files/Pods-HiBit/Pods-HiBit.release.xcconfig"; sourceTree = "<group>"; };
|
||||
7603423F984179550EE5476E /* Pods_HiBit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HiBit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
776EF1D90F08398428F51390 /* Pods-HiBit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HiBit.debug.xcconfig"; path = "Target Support Files/Pods-HiBit/Pods-HiBit.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
9163511E2C12AFE800593047 /* HiBit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HiBit.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9163512D2C12AFEA00593047 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
@ -30,6 +101,149 @@
|
||||
916351422C12B13700593047 /* SceneDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; };
|
||||
916351492C12B49B00593047 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
|
||||
9163514A2C12B4D800593047 /* HiBit-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "HiBit-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
916352472C12B6D400593047 /* FoundationContainer+Log.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "FoundationContainer+Log.m"; sourceTree = "<group>"; };
|
||||
916352492C12B6D400593047 /* NSData+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Extension.h"; sourceTree = "<group>"; };
|
||||
9163524A2C12B6D400593047 /* NSData+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Extension.m"; sourceTree = "<group>"; };
|
||||
9163524C2C12B6D400593047 /* NSDate+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+Extension.h"; sourceTree = "<group>"; };
|
||||
9163524D2C12B6D400593047 /* NSDate+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+Extension.m"; sourceTree = "<group>"; };
|
||||
9163524F2C12B6D400593047 /* NSDictionary+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Extension.h"; sourceTree = "<group>"; };
|
||||
916352502C12B6D400593047 /* NSDictionary+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Extension.m"; sourceTree = "<group>"; };
|
||||
916352522C12B6D400593047 /* NSNumber+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNumber+Extension.h"; sourceTree = "<group>"; };
|
||||
916352532C12B6D400593047 /* NSNumber+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNumber+Extension.m"; sourceTree = "<group>"; };
|
||||
916352552C12B6D400593047 /* NSObject+countDown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+countDown.h"; sourceTree = "<group>"; };
|
||||
916352562C12B6D400593047 /* NSObject+countDown.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+countDown.m"; sourceTree = "<group>"; };
|
||||
916352572C12B6D400593047 /* NSObject+Swizzled.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Swizzled.h"; sourceTree = "<group>"; };
|
||||
916352582C12B6D400593047 /* NSObject+Swizzled.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Swizzled.m"; sourceTree = "<group>"; };
|
||||
916352592C12B6D400593047 /* NSObject+Tool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Tool.h"; sourceTree = "<group>"; };
|
||||
9163525A2C12B6D400593047 /* NSObject+Tool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Tool.m"; sourceTree = "<group>"; };
|
||||
9163525C2C12B6D400593047 /* NSString+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Extension.h"; sourceTree = "<group>"; };
|
||||
9163525D2C12B6D400593047 /* NSString+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Extension.m"; sourceTree = "<group>"; };
|
||||
9163525E2C12B6D400593047 /* NSString+Tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Tools.h"; sourceTree = "<group>"; };
|
||||
9163525F2C12B6D400593047 /* NSString+Tools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Tools.m"; sourceTree = "<group>"; };
|
||||
916352612C12B6D400593047 /* NSUserDefaults+Extesion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSUserDefaults+Extesion.h"; sourceTree = "<group>"; };
|
||||
916352622C12B6D400593047 /* NSUserDefaults+Extesion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSUserDefaults+Extesion.m"; sourceTree = "<group>"; };
|
||||
916352642C12B6D400593047 /* UIColor+Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Category.h"; sourceTree = "<group>"; };
|
||||
916352652C12B6D400593047 /* UIColor+Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Category.m"; sourceTree = "<group>"; };
|
||||
916352672C12B6D400593047 /* UIControl+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIControl+Extension.h"; sourceTree = "<group>"; };
|
||||
916352682C12B6D400593047 /* UIControl+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIControl+Extension.m"; sourceTree = "<group>"; };
|
||||
9163526A2C12B6D400593047 /* UIDevice+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+Extension.h"; sourceTree = "<group>"; };
|
||||
9163526B2C12B6D400593047 /* UIDevice+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+Extension.m"; sourceTree = "<group>"; };
|
||||
9163526D2C12B6D400593047 /* UIFont+Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIFont+Category.h"; sourceTree = "<group>"; };
|
||||
9163526E2C12B6D400593047 /* UIFont+Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIFont+Category.m"; sourceTree = "<group>"; };
|
||||
916352702C12B6D400593047 /* UIImage+Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Category.h"; sourceTree = "<group>"; };
|
||||
916352712C12B6D400593047 /* UIImage+Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Category.m"; sourceTree = "<group>"; };
|
||||
916352732C12B6D400593047 /* UIImageView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+Extension.h"; sourceTree = "<group>"; };
|
||||
916352742C12B6D400593047 /* UIImageView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+Extension.m"; sourceTree = "<group>"; };
|
||||
916352762C12B6D400593047 /* UIScreen+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScreen+Extension.h"; sourceTree = "<group>"; };
|
||||
916352772C12B6D400593047 /* UIScreen+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScreen+Extension.m"; sourceTree = "<group>"; };
|
||||
916352792C12B6D400593047 /* UITableView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+Extension.h"; sourceTree = "<group>"; };
|
||||
9163527A2C12B6D400593047 /* UITableView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView+Extension.m"; sourceTree = "<group>"; };
|
||||
9163527C2C12B6D400593047 /* UITextField+Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITextField+Category.h"; sourceTree = "<group>"; };
|
||||
9163527D2C12B6D400593047 /* UITextField+Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITextField+Category.m"; sourceTree = "<group>"; };
|
||||
9163527F2C12B6D400593047 /* NSLayoutConstraint+BSIBDesignable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSLayoutConstraint+BSIBDesignable.h"; sourceTree = "<group>"; };
|
||||
916352802C12B6D400593047 /* NSLayoutConstraint+BSIBDesignable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSLayoutConstraint+BSIBDesignable.m"; sourceTree = "<group>"; };
|
||||
916352812C12B6D400593047 /* UIView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Extension.h"; sourceTree = "<group>"; };
|
||||
916352822C12B6D400593047 /* UIView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Extension.m"; sourceTree = "<group>"; };
|
||||
916352832C12B6D400593047 /* UIView+Frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Frame.h"; sourceTree = "<group>"; };
|
||||
916352842C12B6D400593047 /* UIView+Frame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Frame.m"; sourceTree = "<group>"; };
|
||||
916352862C12B6D400593047 /* UINavigationController+Transparent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationController+Transparent.h"; sourceTree = "<group>"; };
|
||||
916352872C12B6D400593047 /* UINavigationController+Transparent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UINavigationController+Transparent.m"; sourceTree = "<group>"; };
|
||||
916352882C12B6D400593047 /* UIViewController+present.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+present.h"; sourceTree = "<group>"; };
|
||||
916352892C12B6D400593047 /* UIViewController+present.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+present.m"; sourceTree = "<group>"; };
|
||||
9163528C2C12B6D400593047 /* GTMBase64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTMBase64.h; sourceTree = "<group>"; };
|
||||
9163528D2C12B6D400593047 /* GTMBase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMBase64.m; sourceTree = "<group>"; };
|
||||
9163528E2C12B6D400593047 /* GTMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTMDefines.h; sourceTree = "<group>"; };
|
||||
9163528F2C12B6D400593047 /* NSString+AES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+AES.h"; sourceTree = "<group>"; };
|
||||
916352902C12B6D400593047 /* NSString+AES.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+AES.m"; sourceTree = "<group>"; };
|
||||
916352922C12B6D400593047 /* DGActivityIndicatorAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorAnimation.h; sourceTree = "<group>"; };
|
||||
916352932C12B6D400593047 /* DGActivityIndicatorAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorAnimation.m; sourceTree = "<group>"; };
|
||||
916352942C12B6D400593047 /* DGActivityIndicatorBallBeatAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallBeatAnimation.h; sourceTree = "<group>"; };
|
||||
916352952C12B6D400593047 /* DGActivityIndicatorBallBeatAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallBeatAnimation.m; sourceTree = "<group>"; };
|
||||
916352962C12B6D400593047 /* DGActivityIndicatorBallClipRotateAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallClipRotateAnimation.h; sourceTree = "<group>"; };
|
||||
916352972C12B6D400593047 /* DGActivityIndicatorBallClipRotateAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallClipRotateAnimation.m; sourceTree = "<group>"; };
|
||||
916352982C12B6D400593047 /* DGActivityIndicatorBallClipRotateMultipleAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallClipRotateMultipleAnimation.h; sourceTree = "<group>"; };
|
||||
916352992C12B6D400593047 /* DGActivityIndicatorBallClipRotateMultipleAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallClipRotateMultipleAnimation.m; sourceTree = "<group>"; };
|
||||
9163529A2C12B6D400593047 /* DGActivityIndicatorBallClipRotatePulseAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallClipRotatePulseAnimation.h; sourceTree = "<group>"; };
|
||||
9163529B2C12B6D400593047 /* DGActivityIndicatorBallClipRotatePulseAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallClipRotatePulseAnimation.m; sourceTree = "<group>"; };
|
||||
9163529C2C12B6D400593047 /* DGActivityIndicatorBallGridBeatAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallGridBeatAnimation.h; sourceTree = "<group>"; };
|
||||
9163529D2C12B6D400593047 /* DGActivityIndicatorBallGridBeatAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallGridBeatAnimation.m; sourceTree = "<group>"; };
|
||||
9163529E2C12B6D400593047 /* DGActivityIndicatorBallGridPulseAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallGridPulseAnimation.h; sourceTree = "<group>"; };
|
||||
9163529F2C12B6D400593047 /* DGActivityIndicatorBallGridPulseAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallGridPulseAnimation.m; sourceTree = "<group>"; };
|
||||
916352A02C12B6D400593047 /* DGActivityIndicatorBallPulseAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallPulseAnimation.h; sourceTree = "<group>"; };
|
||||
916352A12C12B6D400593047 /* DGActivityIndicatorBallPulseAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallPulseAnimation.m; sourceTree = "<group>"; };
|
||||
916352A22C12B6D400593047 /* DGActivityIndicatorBallPulseSyncAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallPulseSyncAnimation.h; sourceTree = "<group>"; };
|
||||
916352A32C12B6D400593047 /* DGActivityIndicatorBallPulseSyncAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallPulseSyncAnimation.m; sourceTree = "<group>"; };
|
||||
916352A42C12B6D400593047 /* DGActivityIndicatorBallRotateAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallRotateAnimation.h; sourceTree = "<group>"; };
|
||||
916352A52C12B6D400593047 /* DGActivityIndicatorBallRotateAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallRotateAnimation.m; sourceTree = "<group>"; };
|
||||
916352A62C12B6D400593047 /* DGActivityIndicatorBallScaleAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallScaleAnimation.h; sourceTree = "<group>"; };
|
||||
916352A72C12B6D400593047 /* DGActivityIndicatorBallScaleAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallScaleAnimation.m; sourceTree = "<group>"; };
|
||||
916352A82C12B6D400593047 /* DGActivityIndicatorBallScaleMultipleAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallScaleMultipleAnimation.h; sourceTree = "<group>"; };
|
||||
916352A92C12B6D400593047 /* DGActivityIndicatorBallScaleMultipleAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallScaleMultipleAnimation.m; sourceTree = "<group>"; };
|
||||
916352AA2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallScaleRippleAnimation.h; sourceTree = "<group>"; };
|
||||
916352AB2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallScaleRippleAnimation.m; sourceTree = "<group>"; };
|
||||
916352AC2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleMultipleAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallScaleRippleMultipleAnimation.h; sourceTree = "<group>"; };
|
||||
916352AD2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleMultipleAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallScaleRippleMultipleAnimation.m; sourceTree = "<group>"; };
|
||||
916352AE2C12B6D400593047 /* DGActivityIndicatorBallSpinFadeLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallSpinFadeLoader.h; sourceTree = "<group>"; };
|
||||
916352AF2C12B6D400593047 /* DGActivityIndicatorBallSpinFadeLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallSpinFadeLoader.m; sourceTree = "<group>"; };
|
||||
916352B02C12B6D400593047 /* DGActivityIndicatorBallTrianglePathAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallTrianglePathAnimation.h; sourceTree = "<group>"; };
|
||||
916352B12C12B6D400593047 /* DGActivityIndicatorBallTrianglePathAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallTrianglePathAnimation.m; sourceTree = "<group>"; };
|
||||
916352B22C12B6D400593047 /* DGActivityIndicatorBallZigZagAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallZigZagAnimation.h; sourceTree = "<group>"; };
|
||||
916352B32C12B6D400593047 /* DGActivityIndicatorBallZigZagAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallZigZagAnimation.m; sourceTree = "<group>"; };
|
||||
916352B42C12B6D400593047 /* DGActivityIndicatorBallZigZagDeflectAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorBallZigZagDeflectAnimation.h; sourceTree = "<group>"; };
|
||||
916352B52C12B6D400593047 /* DGActivityIndicatorBallZigZagDeflectAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorBallZigZagDeflectAnimation.m; sourceTree = "<group>"; };
|
||||
916352B62C12B6D400593047 /* DGActivityIndicatorCookieTerminatorAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorCookieTerminatorAnimation.h; sourceTree = "<group>"; };
|
||||
916352B72C12B6D400593047 /* DGActivityIndicatorCookieTerminatorAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorCookieTerminatorAnimation.m; sourceTree = "<group>"; };
|
||||
916352B82C12B6D400593047 /* DGActivityIndicatorDoubleBounceAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorDoubleBounceAnimation.h; sourceTree = "<group>"; };
|
||||
916352B92C12B6D400593047 /* DGActivityIndicatorDoubleBounceAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorDoubleBounceAnimation.m; sourceTree = "<group>"; };
|
||||
916352BA2C12B6D400593047 /* DGActivityIndicatorFiveDotsAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorFiveDotsAnimation.h; sourceTree = "<group>"; };
|
||||
916352BB2C12B6D400593047 /* DGActivityIndicatorFiveDotsAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorFiveDotsAnimation.m; sourceTree = "<group>"; };
|
||||
916352BC2C12B6D400593047 /* DGActivityIndicatorLineScaleAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorLineScaleAnimation.h; sourceTree = "<group>"; };
|
||||
916352BD2C12B6D400593047 /* DGActivityIndicatorLineScaleAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorLineScaleAnimation.m; sourceTree = "<group>"; };
|
||||
916352BE2C12B6D400593047 /* DGActivityIndicatorLineScalePartyAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorLineScalePartyAnimation.h; sourceTree = "<group>"; };
|
||||
916352BF2C12B6D400593047 /* DGActivityIndicatorLineScalePartyAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorLineScalePartyAnimation.m; sourceTree = "<group>"; };
|
||||
916352C02C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorLineScalePulseOutAnimation.h; sourceTree = "<group>"; };
|
||||
916352C12C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorLineScalePulseOutAnimation.m; sourceTree = "<group>"; };
|
||||
916352C22C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutRapidAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorLineScalePulseOutRapidAnimation.h; sourceTree = "<group>"; };
|
||||
916352C32C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutRapidAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorLineScalePulseOutRapidAnimation.m; sourceTree = "<group>"; };
|
||||
916352C42C12B6D400593047 /* DGActivityIndicatorNineDotsAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorNineDotsAnimation.h; sourceTree = "<group>"; };
|
||||
916352C52C12B6D400593047 /* DGActivityIndicatorNineDotsAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorNineDotsAnimation.m; sourceTree = "<group>"; };
|
||||
916352C62C12B6D400593047 /* DGActivityIndicatorRotatingSandglassAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorRotatingSandglassAnimation.h; sourceTree = "<group>"; };
|
||||
916352C72C12B6D400593047 /* DGActivityIndicatorRotatingSandglassAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorRotatingSandglassAnimation.m; sourceTree = "<group>"; };
|
||||
916352C82C12B6D400593047 /* DGActivityIndicatorRotatingSquaresAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorRotatingSquaresAnimation.h; sourceTree = "<group>"; };
|
||||
916352C92C12B6D400593047 /* DGActivityIndicatorRotatingSquaresAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorRotatingSquaresAnimation.m; sourceTree = "<group>"; };
|
||||
916352CA2C12B6D400593047 /* DGActivityIndicatorRotatingTrigonAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorRotatingTrigonAnimation.h; sourceTree = "<group>"; };
|
||||
916352CB2C12B6D400593047 /* DGActivityIndicatorRotatingTrigonAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorRotatingTrigonAnimation.m; sourceTree = "<group>"; };
|
||||
916352CC2C12B6D400593047 /* DGActivityIndicatorThreeDotsAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorThreeDotsAnimation.h; sourceTree = "<group>"; };
|
||||
916352CD2C12B6D400593047 /* DGActivityIndicatorThreeDotsAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorThreeDotsAnimation.m; sourceTree = "<group>"; };
|
||||
916352CE2C12B6D400593047 /* DGActivityIndicatorTriangleSkewSpinAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorTriangleSkewSpinAnimation.h; sourceTree = "<group>"; };
|
||||
916352CF2C12B6D400593047 /* DGActivityIndicatorTriangleSkewSpinAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorTriangleSkewSpinAnimation.m; sourceTree = "<group>"; };
|
||||
916352D02C12B6D400593047 /* DGActivityIndicatorTriplePulseAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorTriplePulseAnimation.h; sourceTree = "<group>"; };
|
||||
916352D12C12B6D400593047 /* DGActivityIndicatorTriplePulseAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorTriplePulseAnimation.m; sourceTree = "<group>"; };
|
||||
916352D22C12B6D400593047 /* DGActivityIndicatorTripleRingsAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorTripleRingsAnimation.h; sourceTree = "<group>"; };
|
||||
916352D32C12B6D400593047 /* DGActivityIndicatorTripleRingsAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorTripleRingsAnimation.m; sourceTree = "<group>"; };
|
||||
916352D42C12B6D400593047 /* DGActivityIndicatorTwoDotsAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorTwoDotsAnimation.h; sourceTree = "<group>"; };
|
||||
916352D52C12B6D400593047 /* DGActivityIndicatorTwoDotsAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorTwoDotsAnimation.m; sourceTree = "<group>"; };
|
||||
916352D72C12B6D400593047 /* DGActivityIndicatorAnimationProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorAnimationProtocol.h; sourceTree = "<group>"; };
|
||||
916352D82C12B6D400593047 /* DGActivityIndicatorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DGActivityIndicatorView.h; sourceTree = "<group>"; };
|
||||
916352D92C12B6D400593047 /* DGActivityIndicatorView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DGActivityIndicatorView.m; sourceTree = "<group>"; };
|
||||
916352DB2C12B6D400593047 /* MBProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBProgressHUD.h; sourceTree = "<group>"; };
|
||||
916352DC2C12B6D400593047 /* MBProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBProgressHUD.m; sourceTree = "<group>"; };
|
||||
916352DE2C12B6D400593047 /* SVIndefiniteAnimatedView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVIndefiniteAnimatedView.h; sourceTree = "<group>"; };
|
||||
916352DF2C12B6D400593047 /* SVIndefiniteAnimatedView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVIndefiniteAnimatedView.m; sourceTree = "<group>"; };
|
||||
916352E02C12B6D400593047 /* SVProgressAnimatedView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVProgressAnimatedView.h; sourceTree = "<group>"; };
|
||||
916352E12C12B6D400593047 /* SVProgressAnimatedView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVProgressAnimatedView.m; sourceTree = "<group>"; };
|
||||
916352E22C12B6D400593047 /* SVProgressHUD-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SVProgressHUD-Prefix.pch"; sourceTree = "<group>"; };
|
||||
916352E32C12B6D400593047 /* SVProgressHUD.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SVProgressHUD.bundle; sourceTree = "<group>"; };
|
||||
916352E42C12B6D400593047 /* SVProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVProgressHUD.h; sourceTree = "<group>"; };
|
||||
916352E52C12B6D400593047 /* SVProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVProgressHUD.m; sourceTree = "<group>"; };
|
||||
916352E62C12B6D400593047 /* SVRadialGradientLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVRadialGradientLayer.h; sourceTree = "<group>"; };
|
||||
916352E72C12B6D400593047 /* SVRadialGradientLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVRadialGradientLayer.m; sourceTree = "<group>"; };
|
||||
916352E92C12B6D400593047 /* HUDManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HUDManager.h; sourceTree = "<group>"; };
|
||||
916352EA2C12B6D400593047 /* HUDManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HUDManager.m; sourceTree = "<group>"; };
|
||||
916352EF2C12B6D400593047 /* KxMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KxMenu.h; sourceTree = "<group>"; };
|
||||
916352F02C12B6D400593047 /* KxMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KxMenu.m; sourceTree = "<group>"; };
|
||||
916352F22C12B6D400593047 /* QJNetWorking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QJNetWorking.h; sourceTree = "<group>"; };
|
||||
916352F32C12B6D400593047 /* QJNetWorking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QJNetWorking.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -37,7 +251,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AC39FB6C929D30EFDAAC6CEB /* Pods_HiBit.framework in Frameworks */,
|
||||
C8AC2283D47E2B99FF559E75 /* libPods-HiBit.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -77,6 +291,7 @@
|
||||
9163513B2C12B0A200593047 /* Project */,
|
||||
9163513D2C12B11A00593047 /* AppDelegate */,
|
||||
916351472C12B40900593047 /* Basics */,
|
||||
916352F52C12B6D400593047 /* Utils */,
|
||||
);
|
||||
path = HiBit;
|
||||
sourceTree = "<group>";
|
||||
@ -112,10 +327,384 @@
|
||||
path = Basics;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352482C12B6D400593047 /* Foundation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352472C12B6D400593047 /* FoundationContainer+Log.m */,
|
||||
);
|
||||
path = Foundation;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9163524B2C12B6D400593047 /* NSData */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352492C12B6D400593047 /* NSData+Extension.h */,
|
||||
9163524A2C12B6D400593047 /* NSData+Extension.m */,
|
||||
);
|
||||
path = NSData;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9163524E2C12B6D400593047 /* NSDate */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9163524C2C12B6D400593047 /* NSDate+Extension.h */,
|
||||
9163524D2C12B6D400593047 /* NSDate+Extension.m */,
|
||||
);
|
||||
path = NSDate;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352512C12B6D400593047 /* NSDictionary */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9163524F2C12B6D400593047 /* NSDictionary+Extension.h */,
|
||||
916352502C12B6D400593047 /* NSDictionary+Extension.m */,
|
||||
);
|
||||
path = NSDictionary;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352542C12B6D400593047 /* NSNumber */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352522C12B6D400593047 /* NSNumber+Extension.h */,
|
||||
916352532C12B6D400593047 /* NSNumber+Extension.m */,
|
||||
);
|
||||
path = NSNumber;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9163525B2C12B6D400593047 /* NSObject */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352552C12B6D400593047 /* NSObject+countDown.h */,
|
||||
916352562C12B6D400593047 /* NSObject+countDown.m */,
|
||||
916352572C12B6D400593047 /* NSObject+Swizzled.h */,
|
||||
916352582C12B6D400593047 /* NSObject+Swizzled.m */,
|
||||
916352592C12B6D400593047 /* NSObject+Tool.h */,
|
||||
9163525A2C12B6D400593047 /* NSObject+Tool.m */,
|
||||
);
|
||||
path = NSObject;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352602C12B6D400593047 /* NSString */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9163525C2C12B6D400593047 /* NSString+Extension.h */,
|
||||
9163525D2C12B6D400593047 /* NSString+Extension.m */,
|
||||
9163525E2C12B6D400593047 /* NSString+Tools.h */,
|
||||
9163525F2C12B6D400593047 /* NSString+Tools.m */,
|
||||
);
|
||||
path = NSString;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352632C12B6D400593047 /* NSUserDefaults */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352612C12B6D400593047 /* NSUserDefaults+Extesion.h */,
|
||||
916352622C12B6D400593047 /* NSUserDefaults+Extesion.m */,
|
||||
);
|
||||
path = NSUserDefaults;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352662C12B6D400593047 /* UIColor */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352642C12B6D400593047 /* UIColor+Category.h */,
|
||||
916352652C12B6D400593047 /* UIColor+Category.m */,
|
||||
);
|
||||
path = UIColor;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352692C12B6D400593047 /* UIControl */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352672C12B6D400593047 /* UIControl+Extension.h */,
|
||||
916352682C12B6D400593047 /* UIControl+Extension.m */,
|
||||
);
|
||||
path = UIControl;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9163526C2C12B6D400593047 /* UIDevice */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9163526A2C12B6D400593047 /* UIDevice+Extension.h */,
|
||||
9163526B2C12B6D400593047 /* UIDevice+Extension.m */,
|
||||
);
|
||||
path = UIDevice;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9163526F2C12B6D400593047 /* UIFont */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9163526D2C12B6D400593047 /* UIFont+Category.h */,
|
||||
9163526E2C12B6D400593047 /* UIFont+Category.m */,
|
||||
);
|
||||
path = UIFont;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352722C12B6D400593047 /* UIImage */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352702C12B6D400593047 /* UIImage+Category.h */,
|
||||
916352712C12B6D400593047 /* UIImage+Category.m */,
|
||||
);
|
||||
path = UIImage;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352752C12B6D400593047 /* UIImageView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352732C12B6D400593047 /* UIImageView+Extension.h */,
|
||||
916352742C12B6D400593047 /* UIImageView+Extension.m */,
|
||||
);
|
||||
path = UIImageView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352782C12B6D400593047 /* UIScreen */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352762C12B6D400593047 /* UIScreen+Extension.h */,
|
||||
916352772C12B6D400593047 /* UIScreen+Extension.m */,
|
||||
);
|
||||
path = UIScreen;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9163527B2C12B6D400593047 /* UITableView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352792C12B6D400593047 /* UITableView+Extension.h */,
|
||||
9163527A2C12B6D400593047 /* UITableView+Extension.m */,
|
||||
);
|
||||
path = UITableView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9163527E2C12B6D400593047 /* UITextField */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9163527C2C12B6D400593047 /* UITextField+Category.h */,
|
||||
9163527D2C12B6D400593047 /* UITextField+Category.m */,
|
||||
);
|
||||
path = UITextField;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352852C12B6D400593047 /* UIView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9163527F2C12B6D400593047 /* NSLayoutConstraint+BSIBDesignable.h */,
|
||||
916352802C12B6D400593047 /* NSLayoutConstraint+BSIBDesignable.m */,
|
||||
916352812C12B6D400593047 /* UIView+Extension.h */,
|
||||
916352822C12B6D400593047 /* UIView+Extension.m */,
|
||||
916352832C12B6D400593047 /* UIView+Frame.h */,
|
||||
916352842C12B6D400593047 /* UIView+Frame.m */,
|
||||
);
|
||||
path = UIView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9163528A2C12B6D400593047 /* UIViewController */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352862C12B6D400593047 /* UINavigationController+Transparent.h */,
|
||||
916352872C12B6D400593047 /* UINavigationController+Transparent.m */,
|
||||
916352882C12B6D400593047 /* UIViewController+present.h */,
|
||||
916352892C12B6D400593047 /* UIViewController+present.m */,
|
||||
);
|
||||
path = UIViewController;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9163528B2C12B6D400593047 /* Category */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352482C12B6D400593047 /* Foundation */,
|
||||
9163524B2C12B6D400593047 /* NSData */,
|
||||
9163524E2C12B6D400593047 /* NSDate */,
|
||||
916352512C12B6D400593047 /* NSDictionary */,
|
||||
916352542C12B6D400593047 /* NSNumber */,
|
||||
9163525B2C12B6D400593047 /* NSObject */,
|
||||
916352602C12B6D400593047 /* NSString */,
|
||||
916352632C12B6D400593047 /* NSUserDefaults */,
|
||||
916352662C12B6D400593047 /* UIColor */,
|
||||
916352692C12B6D400593047 /* UIControl */,
|
||||
9163526C2C12B6D400593047 /* UIDevice */,
|
||||
9163526F2C12B6D400593047 /* UIFont */,
|
||||
916352722C12B6D400593047 /* UIImage */,
|
||||
916352752C12B6D400593047 /* UIImageView */,
|
||||
916352782C12B6D400593047 /* UIScreen */,
|
||||
9163527B2C12B6D400593047 /* UITableView */,
|
||||
9163527E2C12B6D400593047 /* UITextField */,
|
||||
916352852C12B6D400593047 /* UIView */,
|
||||
9163528A2C12B6D400593047 /* UIViewController */,
|
||||
);
|
||||
path = Category;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352912C12B6D400593047 /* GTM+AES */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9163528C2C12B6D400593047 /* GTMBase64.h */,
|
||||
9163528D2C12B6D400593047 /* GTMBase64.m */,
|
||||
9163528E2C12B6D400593047 /* GTMDefines.h */,
|
||||
9163528F2C12B6D400593047 /* NSString+AES.h */,
|
||||
916352902C12B6D400593047 /* NSString+AES.m */,
|
||||
);
|
||||
path = "GTM+AES";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352D62C12B6D400593047 /* Animations */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352922C12B6D400593047 /* DGActivityIndicatorAnimation.h */,
|
||||
916352932C12B6D400593047 /* DGActivityIndicatorAnimation.m */,
|
||||
916352942C12B6D400593047 /* DGActivityIndicatorBallBeatAnimation.h */,
|
||||
916352952C12B6D400593047 /* DGActivityIndicatorBallBeatAnimation.m */,
|
||||
916352962C12B6D400593047 /* DGActivityIndicatorBallClipRotateAnimation.h */,
|
||||
916352972C12B6D400593047 /* DGActivityIndicatorBallClipRotateAnimation.m */,
|
||||
916352982C12B6D400593047 /* DGActivityIndicatorBallClipRotateMultipleAnimation.h */,
|
||||
916352992C12B6D400593047 /* DGActivityIndicatorBallClipRotateMultipleAnimation.m */,
|
||||
9163529A2C12B6D400593047 /* DGActivityIndicatorBallClipRotatePulseAnimation.h */,
|
||||
9163529B2C12B6D400593047 /* DGActivityIndicatorBallClipRotatePulseAnimation.m */,
|
||||
9163529C2C12B6D400593047 /* DGActivityIndicatorBallGridBeatAnimation.h */,
|
||||
9163529D2C12B6D400593047 /* DGActivityIndicatorBallGridBeatAnimation.m */,
|
||||
9163529E2C12B6D400593047 /* DGActivityIndicatorBallGridPulseAnimation.h */,
|
||||
9163529F2C12B6D400593047 /* DGActivityIndicatorBallGridPulseAnimation.m */,
|
||||
916352A02C12B6D400593047 /* DGActivityIndicatorBallPulseAnimation.h */,
|
||||
916352A12C12B6D400593047 /* DGActivityIndicatorBallPulseAnimation.m */,
|
||||
916352A22C12B6D400593047 /* DGActivityIndicatorBallPulseSyncAnimation.h */,
|
||||
916352A32C12B6D400593047 /* DGActivityIndicatorBallPulseSyncAnimation.m */,
|
||||
916352A42C12B6D400593047 /* DGActivityIndicatorBallRotateAnimation.h */,
|
||||
916352A52C12B6D400593047 /* DGActivityIndicatorBallRotateAnimation.m */,
|
||||
916352A62C12B6D400593047 /* DGActivityIndicatorBallScaleAnimation.h */,
|
||||
916352A72C12B6D400593047 /* DGActivityIndicatorBallScaleAnimation.m */,
|
||||
916352A82C12B6D400593047 /* DGActivityIndicatorBallScaleMultipleAnimation.h */,
|
||||
916352A92C12B6D400593047 /* DGActivityIndicatorBallScaleMultipleAnimation.m */,
|
||||
916352AA2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleAnimation.h */,
|
||||
916352AB2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleAnimation.m */,
|
||||
916352AC2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleMultipleAnimation.h */,
|
||||
916352AD2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleMultipleAnimation.m */,
|
||||
916352AE2C12B6D400593047 /* DGActivityIndicatorBallSpinFadeLoader.h */,
|
||||
916352AF2C12B6D400593047 /* DGActivityIndicatorBallSpinFadeLoader.m */,
|
||||
916352B02C12B6D400593047 /* DGActivityIndicatorBallTrianglePathAnimation.h */,
|
||||
916352B12C12B6D400593047 /* DGActivityIndicatorBallTrianglePathAnimation.m */,
|
||||
916352B22C12B6D400593047 /* DGActivityIndicatorBallZigZagAnimation.h */,
|
||||
916352B32C12B6D400593047 /* DGActivityIndicatorBallZigZagAnimation.m */,
|
||||
916352B42C12B6D400593047 /* DGActivityIndicatorBallZigZagDeflectAnimation.h */,
|
||||
916352B52C12B6D400593047 /* DGActivityIndicatorBallZigZagDeflectAnimation.m */,
|
||||
916352B62C12B6D400593047 /* DGActivityIndicatorCookieTerminatorAnimation.h */,
|
||||
916352B72C12B6D400593047 /* DGActivityIndicatorCookieTerminatorAnimation.m */,
|
||||
916352B82C12B6D400593047 /* DGActivityIndicatorDoubleBounceAnimation.h */,
|
||||
916352B92C12B6D400593047 /* DGActivityIndicatorDoubleBounceAnimation.m */,
|
||||
916352BA2C12B6D400593047 /* DGActivityIndicatorFiveDotsAnimation.h */,
|
||||
916352BB2C12B6D400593047 /* DGActivityIndicatorFiveDotsAnimation.m */,
|
||||
916352BC2C12B6D400593047 /* DGActivityIndicatorLineScaleAnimation.h */,
|
||||
916352BD2C12B6D400593047 /* DGActivityIndicatorLineScaleAnimation.m */,
|
||||
916352BE2C12B6D400593047 /* DGActivityIndicatorLineScalePartyAnimation.h */,
|
||||
916352BF2C12B6D400593047 /* DGActivityIndicatorLineScalePartyAnimation.m */,
|
||||
916352C02C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutAnimation.h */,
|
||||
916352C12C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutAnimation.m */,
|
||||
916352C22C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutRapidAnimation.h */,
|
||||
916352C32C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutRapidAnimation.m */,
|
||||
916352C42C12B6D400593047 /* DGActivityIndicatorNineDotsAnimation.h */,
|
||||
916352C52C12B6D400593047 /* DGActivityIndicatorNineDotsAnimation.m */,
|
||||
916352C62C12B6D400593047 /* DGActivityIndicatorRotatingSandglassAnimation.h */,
|
||||
916352C72C12B6D400593047 /* DGActivityIndicatorRotatingSandglassAnimation.m */,
|
||||
916352C82C12B6D400593047 /* DGActivityIndicatorRotatingSquaresAnimation.h */,
|
||||
916352C92C12B6D400593047 /* DGActivityIndicatorRotatingSquaresAnimation.m */,
|
||||
916352CA2C12B6D400593047 /* DGActivityIndicatorRotatingTrigonAnimation.h */,
|
||||
916352CB2C12B6D400593047 /* DGActivityIndicatorRotatingTrigonAnimation.m */,
|
||||
916352CC2C12B6D400593047 /* DGActivityIndicatorThreeDotsAnimation.h */,
|
||||
916352CD2C12B6D400593047 /* DGActivityIndicatorThreeDotsAnimation.m */,
|
||||
916352CE2C12B6D400593047 /* DGActivityIndicatorTriangleSkewSpinAnimation.h */,
|
||||
916352CF2C12B6D400593047 /* DGActivityIndicatorTriangleSkewSpinAnimation.m */,
|
||||
916352D02C12B6D400593047 /* DGActivityIndicatorTriplePulseAnimation.h */,
|
||||
916352D12C12B6D400593047 /* DGActivityIndicatorTriplePulseAnimation.m */,
|
||||
916352D22C12B6D400593047 /* DGActivityIndicatorTripleRingsAnimation.h */,
|
||||
916352D32C12B6D400593047 /* DGActivityIndicatorTripleRingsAnimation.m */,
|
||||
916352D42C12B6D400593047 /* DGActivityIndicatorTwoDotsAnimation.h */,
|
||||
916352D52C12B6D400593047 /* DGActivityIndicatorTwoDotsAnimation.m */,
|
||||
);
|
||||
path = Animations;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352DA2C12B6D400593047 /* DGActivityIndicatorView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352D62C12B6D400593047 /* Animations */,
|
||||
916352D72C12B6D400593047 /* DGActivityIndicatorAnimationProtocol.h */,
|
||||
916352D82C12B6D400593047 /* DGActivityIndicatorView.h */,
|
||||
916352D92C12B6D400593047 /* DGActivityIndicatorView.m */,
|
||||
);
|
||||
path = DGActivityIndicatorView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352DD2C12B6D400593047 /* MBProgressHUD */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352DB2C12B6D400593047 /* MBProgressHUD.h */,
|
||||
916352DC2C12B6D400593047 /* MBProgressHUD.m */,
|
||||
);
|
||||
path = MBProgressHUD;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352E82C12B6D400593047 /* SVProgressHUD */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352DE2C12B6D400593047 /* SVIndefiniteAnimatedView.h */,
|
||||
916352DF2C12B6D400593047 /* SVIndefiniteAnimatedView.m */,
|
||||
916352E02C12B6D400593047 /* SVProgressAnimatedView.h */,
|
||||
916352E12C12B6D400593047 /* SVProgressAnimatedView.m */,
|
||||
916352E22C12B6D400593047 /* SVProgressHUD-Prefix.pch */,
|
||||
916352E32C12B6D400593047 /* SVProgressHUD.bundle */,
|
||||
916352E42C12B6D400593047 /* SVProgressHUD.h */,
|
||||
916352E52C12B6D400593047 /* SVProgressHUD.m */,
|
||||
916352E62C12B6D400593047 /* SVRadialGradientLayer.h */,
|
||||
916352E72C12B6D400593047 /* SVRadialGradientLayer.m */,
|
||||
);
|
||||
path = SVProgressHUD;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352EE2C12B6D400593047 /* HUD */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352E92C12B6D400593047 /* HUDManager.h */,
|
||||
916352EA2C12B6D400593047 /* HUDManager.m */,
|
||||
916352DA2C12B6D400593047 /* DGActivityIndicatorView */,
|
||||
916352DD2C12B6D400593047 /* MBProgressHUD */,
|
||||
916352E82C12B6D400593047 /* SVProgressHUD */,
|
||||
);
|
||||
path = HUD;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352F12C12B6D400593047 /* KxMenu */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352EF2C12B6D400593047 /* KxMenu.h */,
|
||||
916352F02C12B6D400593047 /* KxMenu.m */,
|
||||
);
|
||||
path = KxMenu;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352F42C12B6D400593047 /* NetWorking */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
916352F22C12B6D400593047 /* QJNetWorking.h */,
|
||||
916352F32C12B6D400593047 /* QJNetWorking.m */,
|
||||
);
|
||||
path = NetWorking;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
916352F52C12B6D400593047 /* Utils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9163528B2C12B6D400593047 /* Category */,
|
||||
916352912C12B6D400593047 /* GTM+AES */,
|
||||
916352EE2C12B6D400593047 /* HUD */,
|
||||
916352F12C12B6D400593047 /* KxMenu */,
|
||||
916352F42C12B6D400593047 /* NetWorking */,
|
||||
);
|
||||
path = Utils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B36329ED094310C499FEBA2F /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7603423F984179550EE5476E /* Pods_HiBit.framework */,
|
||||
141F02EF5C0783797594009A /* libPods-HiBit.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@ -131,6 +720,8 @@
|
||||
9163511A2C12AFE800593047 /* Sources */,
|
||||
9163511B2C12AFE800593047 /* Frameworks */,
|
||||
9163511C2C12AFE800593047 /* Resources */,
|
||||
02B844306C0AF014AC968EA5 /* [CP] Embed Pods Frameworks */,
|
||||
5DF1C9072E328AB7A0602389 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -180,6 +771,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9163512E2C12AFEA00593047 /* Assets.xcassets in Resources */,
|
||||
916353372C12B6D400593047 /* SVProgressHUD.bundle in Resources */,
|
||||
916351312C12AFEA00593047 /* Base in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -187,6 +779,23 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
02B844306C0AF014AC968EA5 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-HiBit/Pods-HiBit-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-HiBit/Pods-HiBit-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HiBit/Pods-HiBit-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
0DF2CEAEB1C33630445A7424 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -209,6 +818,23 @@
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
5DF1C9072E328AB7A0602389 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-HiBit/Pods-HiBit-resources-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-HiBit/Pods-HiBit-resources-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HiBit/Pods-HiBit-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@ -216,9 +842,79 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
916353002C12B6D400593047 /* NSUserDefaults+Extesion.m in Sources */,
|
||||
916351402C12B12F00593047 /* AppDelegate.m in Sources */,
|
||||
9163530D2C12B6D400593047 /* UINavigationController+Transparent.m in Sources */,
|
||||
916352FA2C12B6D400593047 /* NSNumber+Extension.m in Sources */,
|
||||
916353292C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutRapidAnimation.m in Sources */,
|
||||
916353232C12B6D400593047 /* DGActivityIndicatorCookieTerminatorAnimation.m in Sources */,
|
||||
9163530A2C12B6D400593047 /* NSLayoutConstraint+BSIBDesignable.m in Sources */,
|
||||
916353352C12B6D400593047 /* SVIndefiniteAnimatedView.m in Sources */,
|
||||
916353332C12B6D400593047 /* DGActivityIndicatorView.m in Sources */,
|
||||
916353152C12B6D400593047 /* DGActivityIndicatorBallClipRotatePulseAnimation.m in Sources */,
|
||||
916353132C12B6D400593047 /* DGActivityIndicatorBallClipRotateAnimation.m in Sources */,
|
||||
916353322C12B6D400593047 /* DGActivityIndicatorTwoDotsAnimation.m in Sources */,
|
||||
9163532B2C12B6D400593047 /* DGActivityIndicatorRotatingSandglassAnimation.m in Sources */,
|
||||
916351432C12B13700593047 /* SceneDelegate.m in Sources */,
|
||||
9163530E2C12B6D400593047 /* UIViewController+present.m in Sources */,
|
||||
916353212C12B6D400593047 /* DGActivityIndicatorBallZigZagAnimation.m in Sources */,
|
||||
916353262C12B6D400593047 /* DGActivityIndicatorLineScaleAnimation.m in Sources */,
|
||||
916353272C12B6D400593047 /* DGActivityIndicatorLineScalePartyAnimation.m in Sources */,
|
||||
916353102C12B6D400593047 /* NSString+AES.m in Sources */,
|
||||
9163531A2C12B6D400593047 /* DGActivityIndicatorBallRotateAnimation.m in Sources */,
|
||||
916352F82C12B6D400593047 /* NSDate+Extension.m in Sources */,
|
||||
916353032C12B6D400593047 /* UIDevice+Extension.m in Sources */,
|
||||
916353252C12B6D400593047 /* DGActivityIndicatorFiveDotsAnimation.m in Sources */,
|
||||
9163531D2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleAnimation.m in Sources */,
|
||||
9163533A2C12B6D400593047 /* HUDManager.m in Sources */,
|
||||
916353072C12B6D400593047 /* UIScreen+Extension.m in Sources */,
|
||||
916353282C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutAnimation.m in Sources */,
|
||||
9163531C2C12B6D400593047 /* DGActivityIndicatorBallScaleMultipleAnimation.m in Sources */,
|
||||
9163533E2C12B6D400593047 /* QJNetWorking.m in Sources */,
|
||||
916353042C12B6D400593047 /* UIFont+Category.m in Sources */,
|
||||
916353092C12B6D400593047 /* UITextField+Category.m in Sources */,
|
||||
916353162C12B6D400593047 /* DGActivityIndicatorBallGridBeatAnimation.m in Sources */,
|
||||
916353122C12B6D400593047 /* DGActivityIndicatorBallBeatAnimation.m in Sources */,
|
||||
916353202C12B6D400593047 /* DGActivityIndicatorBallTrianglePathAnimation.m in Sources */,
|
||||
916352FB2C12B6D400593047 /* NSObject+countDown.m in Sources */,
|
||||
916352FC2C12B6D400593047 /* NSObject+Swizzled.m in Sources */,
|
||||
9163531F2C12B6D400593047 /* DGActivityIndicatorBallSpinFadeLoader.m in Sources */,
|
||||
916353302C12B6D400593047 /* DGActivityIndicatorTriplePulseAnimation.m in Sources */,
|
||||
916353022C12B6D400593047 /* UIControl+Extension.m in Sources */,
|
||||
9163532D2C12B6D400593047 /* DGActivityIndicatorRotatingTrigonAnimation.m in Sources */,
|
||||
916353342C12B6D400593047 /* MBProgressHUD.m in Sources */,
|
||||
916353242C12B6D400593047 /* DGActivityIndicatorDoubleBounceAnimation.m in Sources */,
|
||||
916353192C12B6D400593047 /* DGActivityIndicatorBallPulseSyncAnimation.m in Sources */,
|
||||
9163532A2C12B6D400593047 /* DGActivityIndicatorNineDotsAnimation.m in Sources */,
|
||||
9163533D2C12B6D400593047 /* KxMenu.m in Sources */,
|
||||
9163531E2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleMultipleAnimation.m in Sources */,
|
||||
916353362C12B6D400593047 /* SVProgressAnimatedView.m in Sources */,
|
||||
916353112C12B6D400593047 /* DGActivityIndicatorAnimation.m in Sources */,
|
||||
916353222C12B6D400593047 /* DGActivityIndicatorBallZigZagDeflectAnimation.m in Sources */,
|
||||
9163531B2C12B6D400593047 /* DGActivityIndicatorBallScaleAnimation.m in Sources */,
|
||||
916353182C12B6D400593047 /* DGActivityIndicatorBallPulseAnimation.m in Sources */,
|
||||
916353052C12B6D400593047 /* UIImage+Category.m in Sources */,
|
||||
916353392C12B6D400593047 /* SVRadialGradientLayer.m in Sources */,
|
||||
916351342C12AFEA00593047 /* main.m in Sources */,
|
||||
916353312C12B6D400593047 /* DGActivityIndicatorTripleRingsAnimation.m in Sources */,
|
||||
916352FE2C12B6D400593047 /* NSString+Extension.m in Sources */,
|
||||
916352FD2C12B6D400593047 /* NSObject+Tool.m in Sources */,
|
||||
9163530F2C12B6D400593047 /* GTMBase64.m in Sources */,
|
||||
916353062C12B6D400593047 /* UIImageView+Extension.m in Sources */,
|
||||
9163530C2C12B6D400593047 /* UIView+Frame.m in Sources */,
|
||||
916353382C12B6D400593047 /* SVProgressHUD.m in Sources */,
|
||||
916353142C12B6D400593047 /* DGActivityIndicatorBallClipRotateMultipleAnimation.m in Sources */,
|
||||
916353172C12B6D400593047 /* DGActivityIndicatorBallGridPulseAnimation.m in Sources */,
|
||||
916352FF2C12B6D400593047 /* NSString+Tools.m in Sources */,
|
||||
916352F92C12B6D400593047 /* NSDictionary+Extension.m in Sources */,
|
||||
9163530B2C12B6D400593047 /* UIView+Extension.m in Sources */,
|
||||
916352F62C12B6D400593047 /* FoundationContainer+Log.m in Sources */,
|
||||
916353082C12B6D400593047 /* UITableView+Extension.m in Sources */,
|
||||
916352F72C12B6D400593047 /* NSData+Extension.m in Sources */,
|
||||
9163532E2C12B6D400593047 /* DGActivityIndicatorThreeDotsAnimation.m in Sources */,
|
||||
9163532F2C12B6D400593047 /* DGActivityIndicatorTriangleSkewSpinAnimation.m in Sources */,
|
||||
916353012C12B6D400593047 /* UIColor+Category.m in Sources */,
|
||||
9163532C2C12B6D400593047 /* DGActivityIndicatorRotatingSquaresAnimation.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -362,6 +1058,7 @@
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 38X8FL2527;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_PREFIX_HEADER = "$(SRCROOT)/Hibit/Project/PrefixHeader.pch";
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = HiBit/Project/Info.plist;
|
||||
@ -395,6 +1092,7 @@
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 38X8FL2527;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_PREFIX_HEADER = "$(SRCROOT)/Hibit/Project/PrefixHeader.pch";
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = HiBit/Project/Info.plist;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<key>HiBit.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>67</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
189
HiBit/Utils/Category/Foundation/FoundationContainer+Log.m
Executable file
189
HiBit/Utils/Category/Foundation/FoundationContainer+Log.m
Executable file
@ -0,0 +1,189 @@
|
||||
//
|
||||
// FoundationContainer+Log.m
|
||||
// ConsoleLogFixup
|
||||
//
|
||||
// Created by Damon on 2018/8/7.
|
||||
// Copyright © 2018 BigCuteFish. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#if DEBUG
|
||||
@implementation NSArray (Log)
|
||||
- (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level {
|
||||
NSMutableString *desc = [NSMutableString string];
|
||||
NSMutableString *originalStr = [[NSMutableString alloc] initWithCapacity:level];
|
||||
for (NSUInteger i = 0; i < level; ++i) {
|
||||
[originalStr appendString:@"\t"];
|
||||
}
|
||||
NSString *tab = @"";
|
||||
if (level > 0) {
|
||||
tab = originalStr;
|
||||
}
|
||||
[desc appendString:@"\t(\n"];
|
||||
[self enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj isKindOfClass:[NSDictionary class]]
|
||||
|| [obj isKindOfClass:[NSArray class]]
|
||||
|| [obj isKindOfClass:[NSSet class]]) {
|
||||
NSString *str = [((NSDictionary *)obj) descriptionWithLocale:locale indent:level + 1];
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, str];
|
||||
} else if ([obj isKindOfClass:[NSString class]]) {
|
||||
[desc appendFormat:@"%@\t\"%@\",\n", tab, obj];
|
||||
} else if ([obj isKindOfClass:[NSData class]]) {
|
||||
|
||||
NSError *error = nil;
|
||||
NSObject *result = [NSJSONSerialization JSONObjectWithData:obj
|
||||
options:NSJSONReadingMutableContainers
|
||||
error:&error];
|
||||
|
||||
if (error == nil && result != nil) {
|
||||
if ([result isKindOfClass:[NSDictionary class]]
|
||||
|| [result isKindOfClass:[NSArray class]]
|
||||
|| [result isKindOfClass:[NSSet class]]) {
|
||||
NSString *str = [((NSDictionary *)result) descriptionWithLocale:locale indent:level + 1];
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, str];
|
||||
} else if ([obj isKindOfClass:[NSString class]]) {
|
||||
[desc appendFormat:@"%@\t\"%@\",\n", tab, result];
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
NSString *str = [[NSString alloc] initWithData:obj encoding:NSUTF8StringEncoding];
|
||||
if (str != nil) {
|
||||
[desc appendFormat:@"%@\t\"%@\",\n", tab, str];
|
||||
} else {
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, obj];
|
||||
}
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, obj];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, obj];
|
||||
}
|
||||
}];
|
||||
[desc appendFormat:@"%@)", tab];
|
||||
return desc;
|
||||
}
|
||||
@end
|
||||
@implementation NSSet (Log)
|
||||
- (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level {
|
||||
NSMutableString *desc = [NSMutableString string];
|
||||
|
||||
NSMutableString *originalStr = [[NSMutableString alloc] initWithCapacity:level];
|
||||
for (NSUInteger i = 0; i < level; ++i) {
|
||||
[originalStr appendString:@"\t"];
|
||||
}
|
||||
NSString *tab = @"\t";
|
||||
if (level > 0) {
|
||||
tab = originalStr;
|
||||
}
|
||||
[desc appendString:@"\t{(\n"];
|
||||
[self enumerateObjectsUsingBlock:^(id _Nonnull obj, BOOL * _Nonnull stop) {
|
||||
if ([obj isKindOfClass:[NSDictionary class]]
|
||||
|| [obj isKindOfClass:[NSArray class]]
|
||||
|| [obj isKindOfClass:[NSSet class]]) {
|
||||
NSString *str = [((NSDictionary *)obj) descriptionWithLocale:locale indent:level + 1];
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, str];
|
||||
} else if ([obj isKindOfClass:[NSString class]]) {
|
||||
[desc appendFormat:@"%@\t\"%@\",\n", tab, obj];
|
||||
} else if ([obj isKindOfClass:[NSData class]]) {
|
||||
// if is NSData,try parse
|
||||
NSError *error = nil;
|
||||
NSObject *result = [NSJSONSerialization JSONObjectWithData:obj
|
||||
options:NSJSONReadingMutableContainers
|
||||
error:&error];
|
||||
|
||||
if (error == nil && result != nil) {
|
||||
if ([result isKindOfClass:[NSDictionary class]]
|
||||
|| [result isKindOfClass:[NSArray class]]
|
||||
|| [result isKindOfClass:[NSSet class]]) {
|
||||
NSString *str = [((NSDictionary *)result) descriptionWithLocale:locale indent:level + 1];
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, str];
|
||||
} else if ([obj isKindOfClass:[NSString class]]) {
|
||||
[desc appendFormat:@"%@\t\"%@\",\n", tab, result];
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
NSString *str = [[NSString alloc] initWithData:obj encoding:NSUTF8StringEncoding];
|
||||
if (str != nil) {
|
||||
[desc appendFormat:@"%@\t\"%@\",\n", tab, str];
|
||||
} else {
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, obj];
|
||||
}
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, obj];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
[desc appendFormat:@"%@\t%@,\n", tab, obj];
|
||||
}
|
||||
}];
|
||||
[desc appendFormat:@"%@)}", tab];
|
||||
return desc;
|
||||
}
|
||||
@end
|
||||
@implementation NSDictionary (Log)
|
||||
- (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level {
|
||||
NSMutableString *desc = [NSMutableString string];
|
||||
|
||||
NSMutableString *originalStr = [[NSMutableString alloc] initWithCapacity:level];
|
||||
for (NSUInteger i = 0; i < level; ++i) {
|
||||
[originalStr appendString:@"\t"];
|
||||
}
|
||||
|
||||
NSString *tab = @"";
|
||||
if (level > 0) {
|
||||
tab = originalStr;
|
||||
}
|
||||
|
||||
[desc appendString:@"\t{\n"];
|
||||
|
||||
[self.allKeys enumerateObjectsUsingBlock:^(id _Nonnull key, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
id obj = [self objectForKey:key];
|
||||
|
||||
if ([obj isKindOfClass:[NSString class]]) {
|
||||
[desc appendFormat:@"%@\t%@ = \"%@\",\n", tab, key, obj];
|
||||
} else if ([obj isKindOfClass:[NSArray class]]
|
||||
|| [obj isKindOfClass:[NSDictionary class]]
|
||||
|| [obj isKindOfClass:[NSSet class]]) {
|
||||
[desc appendFormat:@"%@\t%@ = %@,\n", tab, key, [obj descriptionWithLocale:locale indent:level + 1]];
|
||||
} else if ([obj isKindOfClass:[NSData class]]) {
|
||||
|
||||
NSError *error = nil;
|
||||
NSObject *result = [NSJSONSerialization JSONObjectWithData:obj
|
||||
options:NSJSONReadingMutableContainers
|
||||
error:&error];
|
||||
|
||||
if (error == nil && result != nil) {
|
||||
if ([result isKindOfClass:[NSDictionary class]]
|
||||
|| [result isKindOfClass:[NSArray class]]
|
||||
|| [result isKindOfClass:[NSSet class]]) {
|
||||
NSString *str = [((NSDictionary *)result) descriptionWithLocale:locale indent:level + 1];
|
||||
[desc appendFormat:@"%@\t%@ = %@,\n", tab, key, str];
|
||||
} else if ([obj isKindOfClass:[NSString class]]) {
|
||||
[desc appendFormat:@"%@\t%@ = \"%@\",\n", tab, key, result];
|
||||
}
|
||||
} else {
|
||||
@try {
|
||||
NSString *str = [[NSString alloc] initWithData:obj encoding:NSUTF8StringEncoding];
|
||||
if (str != nil) {
|
||||
[desc appendFormat:@"%@\t%@ = \"%@\",\n", tab, key, str];
|
||||
} else {
|
||||
[desc appendFormat:@"%@\t%@ = %@,\n", tab, key, obj];
|
||||
}
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
[desc appendFormat:@"%@\t%@ = %@,\n", tab, key, obj];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
[desc appendFormat:@"%@\t%@ = %@,\n", tab, key, obj];
|
||||
}
|
||||
}];
|
||||
[desc appendFormat:@"%@}", tab];
|
||||
return desc;
|
||||
}
|
||||
@end
|
||||
#endif
|
21
HiBit/Utils/Category/NSData/NSData+Extension.h
Normal file
21
HiBit/Utils/Category/NSData/NSData+Extension.h
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// NSData+Extension.h
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/9/3.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSData (Extension)
|
||||
|
||||
/// 获取拓展名
|
||||
- (NSString *)pathExtension;
|
||||
|
||||
/// 转 array or dict
|
||||
- (id)jsonObject;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
49
HiBit/Utils/Category/NSData/NSData+Extension.m
Normal file
49
HiBit/Utils/Category/NSData/NSData+Extension.m
Normal file
@ -0,0 +1,49 @@
|
||||
//
|
||||
// NSData+Extension.m
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/9/3.
|
||||
//
|
||||
|
||||
#import "NSData+Extension.h"
|
||||
|
||||
@implementation NSData (Extension)
|
||||
- (NSString *)pathExtension{
|
||||
uint8_t buffer_1,buffer_2;
|
||||
|
||||
[self getBytes:&buffer_1 range:NSMakeRange(0, 1)];
|
||||
[self getBytes:&buffer_2 range:NSMakeRange(1, 1)];
|
||||
|
||||
NSInteger type = [NSString stringWithFormat:@"%i%i",buffer_1,buffer_2].integerValue;
|
||||
|
||||
switch (type) {
|
||||
case 3780: return @"pdf";
|
||||
case 255216: return @"jpg";
|
||||
case 7173: return @"gif";
|
||||
case 6677: return @"bmp";
|
||||
case 13780: return @"png";
|
||||
case 6787: return @"swf";
|
||||
case 7790: return @"exe";
|
||||
case 8297: return @"rar";
|
||||
case 8075: return @"zip";
|
||||
case 55122: return @"7z";
|
||||
case 6063: return @"xml";
|
||||
case 6033: return @"html";
|
||||
case 239187: return @"aspx";
|
||||
case 117115: return @"cs";
|
||||
case 119105: return @"js";
|
||||
case 102100: return @"txt";
|
||||
case 255254: return @"sql";
|
||||
default: return nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (id)jsonObject {
|
||||
if (self) {
|
||||
return [NSJSONSerialization JSONObjectWithData:self options:kNilOptions error:nil];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
@end
|
||||
|
22
HiBit/Utils/Category/NSDate/NSDate+Extension.h
Normal file
22
HiBit/Utils/Category/NSDate/NSDate+Extension.h
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// NSDate+Extension.h
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/8/30.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSDate (Extension)
|
||||
+ (NSString *)timestamp;
|
||||
+ (NSDate *)dateWithString:(NSString *)string formatString:(NSString *) formatString;
|
||||
|
||||
- (NSString *)distanceTimeString;
|
||||
|
||||
- (NSString*)dateFormat:(NSString*)format;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
78
HiBit/Utils/Category/NSDate/NSDate+Extension.m
Normal file
78
HiBit/Utils/Category/NSDate/NSDate+Extension.m
Normal file
@ -0,0 +1,78 @@
|
||||
//
|
||||
// NSDate+Extension.m
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/8/30.
|
||||
//
|
||||
|
||||
#import "NSDate+Extension.h"
|
||||
|
||||
@implementation NSDate (Extension)
|
||||
+ (NSString *)timestamp{
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0]; // 获取当前时间0秒后的时间
|
||||
// *1000 是精确到毫秒(13位),不乘就是精确到秒(10位)
|
||||
// NSTimeInterval time = [date timeIntervalSince1970]*1000;
|
||||
NSTimeInterval time = [date timeIntervalSince1970];// *1000 是精确到毫秒(13位),不乘就是精确到秒(10位)
|
||||
|
||||
return [NSString stringWithFormat:@"%.0f", time];
|
||||
}
|
||||
|
||||
- (NSString *)distanceTimeString {
|
||||
|
||||
NSDateFormatter * formatter = [[NSDateFormatter alloc]init];
|
||||
formatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"];
|
||||
formatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
|
||||
|
||||
NSDate * date = [NSDate dateWithTimeIntervalSinceNow:0];
|
||||
|
||||
NSCalendar * calendar = [NSCalendar currentCalendar];
|
||||
|
||||
if ([calendar isDateInToday:self]){
|
||||
NSTimeInterval since = [date timeIntervalSinceDate:self];
|
||||
|
||||
// 是否是刚刚
|
||||
if (since < 60.0 ){
|
||||
return @"刚刚";
|
||||
}
|
||||
// 是否是多少分钟内
|
||||
if (since < 60 * 60) {
|
||||
return [NSString stringWithFormat:@"%d分钟前",since/60];
|
||||
}
|
||||
// 是否是多少小时内
|
||||
return [NSString stringWithFormat:@"%d小时前",since/(3600)];
|
||||
}
|
||||
|
||||
if ([calendar isDateInYesterday:self]) {
|
||||
formatter.dateFormat = @"HH:mm:ss";
|
||||
return [NSString stringWithFormat:@"昨天 %@",[formatter stringFromDate:self]];
|
||||
} else {
|
||||
formatter.dateFormat = @"MM-dd HH:mm:ss";
|
||||
NSDateComponents * comps = [calendar components:NSCalendarUnitYear
|
||||
fromDate:self
|
||||
toDate:date
|
||||
options:NSCalendarWrapComponents];
|
||||
if (comps.year >= 1) {
|
||||
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
|
||||
}
|
||||
}
|
||||
|
||||
return [formatter stringFromDate:self];;
|
||||
}
|
||||
|
||||
+ (NSDate *)dateWithString:(NSString *)string formatString:(NSString *)formatString {
|
||||
NSDateFormatter * formatter = [[NSDateFormatter alloc]init];
|
||||
formatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"];
|
||||
formatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
|
||||
formatter.dateFormat = formatString;
|
||||
return [formatter dateFromString:string];
|
||||
}
|
||||
|
||||
|
||||
- (NSString*)dateFormat:(NSString*) format {
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||||
formatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"];
|
||||
formatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US"];
|
||||
formatter.dateFormat = format;
|
||||
return [formatter stringFromDate:self];
|
||||
}
|
||||
@end
|
18
HiBit/Utils/Category/NSDictionary/NSDictionary+Extension.h
Normal file
18
HiBit/Utils/Category/NSDictionary/NSDictionary+Extension.h
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// NSDictionary+Extension.h
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/9/1.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSDictionary (Extension)
|
||||
|
||||
/// 转string
|
||||
- (NSString *)JSONString;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
23
HiBit/Utils/Category/NSDictionary/NSDictionary+Extension.m
Normal file
23
HiBit/Utils/Category/NSDictionary/NSDictionary+Extension.m
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// NSDictionary+Extension.m
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/9/1.
|
||||
//
|
||||
|
||||
#import "NSDictionary+Extension.h"
|
||||
#import "NSString+Extension.h"
|
||||
@implementation NSDictionary (Extension)
|
||||
|
||||
- (NSString *)JSONString {
|
||||
if (!self) return nil;
|
||||
|
||||
NSError *error;
|
||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self
|
||||
options:NSJSONWritingFragmentsAllowed
|
||||
error:&error];
|
||||
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||
|
||||
}
|
||||
|
||||
@end
|
18
HiBit/Utils/Category/NSNumber/NSNumber+Extension.h
Normal file
18
HiBit/Utils/Category/NSNumber/NSNumber+Extension.h
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// NSNumber+Extension.h
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/8/30.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSNumber (Extension)
|
||||
+ (NSNumber *) numberWithString:(NSString *)string;
|
||||
- (NSString *) toString;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
19
HiBit/Utils/Category/NSNumber/NSNumber+Extension.m
Normal file
19
HiBit/Utils/Category/NSNumber/NSNumber+Extension.m
Normal file
@ -0,0 +1,19 @@
|
||||
//
|
||||
// NSNumber+Extension.m
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/8/30.
|
||||
//
|
||||
|
||||
#import "NSNumber+Extension.h"
|
||||
|
||||
@implementation NSNumber (Extension)
|
||||
+ (NSNumber *) numberWithString:(NSString *)string {
|
||||
NSNumberFormatter * formatter = [[NSNumberFormatter alloc]init];
|
||||
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];
|
||||
return [formatter numberFromString:string];
|
||||
}
|
||||
- (NSString *) toString {
|
||||
return self.stringValue;
|
||||
}
|
||||
@end
|
18
HiBit/Utils/Category/NSObject/NSObject+Swizzled.h
Normal file
18
HiBit/Utils/Category/NSObject/NSObject+Swizzled.h
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// NSObject+Swizzled.h
|
||||
// LVTravel
|
||||
//
|
||||
// Created by LOSER on 2020/5/26.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <objc/runtime.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSObject (Swizzled)
|
||||
void swizzling_exchangeMethod(Class class, SEL originalSelector, SEL swizzledSelector);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
32
HiBit/Utils/Category/NSObject/NSObject+Swizzled.m
Normal file
32
HiBit/Utils/Category/NSObject/NSObject+Swizzled.m
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// NSObject+Swizzled.m
|
||||
// LVTravel
|
||||
//
|
||||
// Created by LOSER on 2020/5/26.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSObject+Swizzled.h"
|
||||
|
||||
|
||||
@implementation NSObject (Swizzled)
|
||||
void swizzling_exchangeMethod(Class class, SEL originalSelector, SEL swizzledSelector){
|
||||
Method originalMethod = class_getInstanceMethod(class, originalSelector);
|
||||
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
|
||||
|
||||
BOOL didAddMethod =
|
||||
class_addMethod(class,
|
||||
originalSelector,
|
||||
method_getImplementation(swizzledMethod),
|
||||
method_getTypeEncoding(swizzledMethod));
|
||||
|
||||
if (didAddMethod) {
|
||||
class_replaceMethod(class,
|
||||
swizzledSelector,
|
||||
method_getImplementation(originalMethod),
|
||||
method_getTypeEncoding(originalMethod));
|
||||
} else {
|
||||
method_exchangeImplementations(originalMethod, swizzledMethod);
|
||||
}
|
||||
}
|
||||
@end
|
23
HiBit/Utils/Category/NSObject/NSObject+Tool.h
Normal file
23
HiBit/Utils/Category/NSObject/NSObject+Tool.h
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// NSObject+Tool.h
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/3/7.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSObject (Tool)
|
||||
|
||||
+ (NSString *)build;
|
||||
/// 获取当前版本
|
||||
+ (NSString *)version;
|
||||
|
||||
/// 是否有安全区域
|
||||
- (BOOL)safeArea;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
32
HiBit/Utils/Category/NSObject/NSObject+Tool.m
Normal file
32
HiBit/Utils/Category/NSObject/NSObject+Tool.m
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// NSObject+Tool.m
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/3/7.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSObject+Tool.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@implementation NSObject (Tool)
|
||||
|
||||
+ (NSString *)build{
|
||||
return [[[NSBundle mainBundle] infoDictionary]objectForKey:@"CFBundleVersion"];
|
||||
}
|
||||
|
||||
+ (NSString *)version{
|
||||
return [[[NSBundle mainBundle] infoDictionary]objectForKey:@"CFBundleShortVersionString"];
|
||||
}
|
||||
- (BOOL)safeArea{
|
||||
if(@available(iOS 11.0, *)) {
|
||||
UIWindow *keyWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
|
||||
CGFloat bottomSafeInset = keyWindow.safeAreaInsets.bottom;
|
||||
if(bottomSafeInset == 34.0f|| bottomSafeInset == 21.0f) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
21
HiBit/Utils/Category/NSObject/NSObject+countDown.h
Normal file
21
HiBit/Utils/Category/NSObject/NSObject+countDown.h
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// NSObject+countDown.h
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/2/26.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSObject (countDown)
|
||||
|
||||
/// 倒计时
|
||||
/// @param number 倒计时开始时间
|
||||
/// @param completeBlock 回调
|
||||
- (dispatch_source_t)countdownWithNumber:(int)number completion:(void(^)(NSInteger second,BOOL success))completeBlock;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
42
HiBit/Utils/Category/NSObject/NSObject+countDown.m
Normal file
42
HiBit/Utils/Category/NSObject/NSObject+countDown.m
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// NSObject+countDown.m
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/2/26.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSObject+countDown.h"
|
||||
|
||||
@implementation NSObject (countDown)
|
||||
- (dispatch_source_t)countdownWithNumber:(int)number completion:(void(^)(NSInteger second,BOOL success))completeBlock{
|
||||
if (number < 0) return nil;
|
||||
__block NSInteger second = number;
|
||||
//(1)
|
||||
dispatch_queue_t quene = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
//(2)
|
||||
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, quene);
|
||||
//(3)
|
||||
dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
|
||||
//(4)
|
||||
dispatch_source_set_event_handler(timer, ^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (second == 0) {
|
||||
//(6)
|
||||
dispatch_cancel(timer);
|
||||
if (completeBlock) {
|
||||
completeBlock(second,YES);
|
||||
}
|
||||
} else {
|
||||
if (completeBlock) {
|
||||
completeBlock(second,NO);
|
||||
}
|
||||
second--;
|
||||
}
|
||||
});
|
||||
});
|
||||
//(5)
|
||||
dispatch_resume(timer);
|
||||
return timer;
|
||||
}
|
||||
@end
|
96
HiBit/Utils/Category/NSString/NSString+Extension.h
Normal file
96
HiBit/Utils/Category/NSString/NSString+Extension.h
Normal file
@ -0,0 +1,96 @@
|
||||
//
|
||||
// NSString+Extension.h
|
||||
// whale
|
||||
//
|
||||
// Created by LOSER on 2020/11/23.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
#pragma mark --- Extension ---
|
||||
@interface NSString (Extension)
|
||||
|
||||
/// 随机字符
|
||||
/// @param count 默认16
|
||||
+ (NSString *)randomString:(int)count;
|
||||
|
||||
/// 字符串url编码
|
||||
- (NSString *)encodingUrl;
|
||||
|
||||
/// 转NSURL
|
||||
- (NSURL *)toUrl;
|
||||
|
||||
+ (NSString *)signWithParams:(NSDictionary *)info;
|
||||
+ (NSString *)stringWithArray:(NSArray *)array;
|
||||
+ (NSString *)stringWithDict:(NSDictionary *)dict;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark --- Validation ---
|
||||
/// 正则表达式验证
|
||||
@interface NSString (Validation)
|
||||
|
||||
/// 金额 保留小数点后两位
|
||||
- (BOOL)isPrice;
|
||||
|
||||
/// 邮箱
|
||||
- (BOOL)isEmail;
|
||||
|
||||
/// 网址
|
||||
- (BOOL)isUrl;
|
||||
|
||||
/// 以字母开头,只能包含“字母”,“数字”,“下划线”,长度6~18
|
||||
/// 有别的需求可以用 -evaluateWithPredicateString 自定义
|
||||
- (BOOL)isPassword;
|
||||
|
||||
/// 中文
|
||||
- (BOOL)isChinese;
|
||||
|
||||
/// 手机号码 只比对了11位数字
|
||||
/// 没有做详细比对
|
||||
- (BOOL)isMobile;
|
||||
|
||||
/// 6位数数字的支付密码
|
||||
- (BOOL)isPayPassword;
|
||||
|
||||
/// 验证 sting 是否符合 predicate 正则表达式
|
||||
/// @param predicate 正则表达式
|
||||
- (BOOL)evaluateWithPredicateString:(NSString *)predicate;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark --- Empty ---
|
||||
@interface NSString (Empty)
|
||||
|
||||
/// 字符串是否为空
|
||||
/// @param string string
|
||||
+ (BOOL)empty:(NSString *)string;
|
||||
|
||||
/// 字符串是否为空
|
||||
/// string == nil 时不会调用判断
|
||||
/// @property (copy, nonatomic, nullable) NSString * string; 可以调用
|
||||
/// @property (copy, nonatomic) NSString * string; 不可以调用,少了nullable
|
||||
/// 不确定是不是nullable 就用上面的判断
|
||||
/// 此方法不严谨 [nil isEmpty] 不会调用, 可以使用[NSString empty: xxx] 方法
|
||||
- (BOOL)empty;
|
||||
|
||||
- (NSString *)safeString;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark --- Encrypt ---
|
||||
@interface NSString (Encrypt)
|
||||
|
||||
/// SHA256 加密
|
||||
- (NSString *)SHA256String;
|
||||
|
||||
/// SHA256 加密
|
||||
/// @param key 盐
|
||||
- (NSString *)SHA256WithKey:(NSString *)key;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
212
HiBit/Utils/Category/NSString/NSString+Extension.m
Normal file
212
HiBit/Utils/Category/NSString/NSString+Extension.m
Normal file
@ -0,0 +1,212 @@
|
||||
//
|
||||
// NSString+Extension.m
|
||||
// whale
|
||||
//
|
||||
// Created by LOSER on 2020/11/23.
|
||||
//
|
||||
|
||||
#import "NSString+Extension.h"
|
||||
#import <CommonCrypto/CommonHMAC.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
#pragma mark --- Extension ---
|
||||
@implementation NSString (Extension)
|
||||
|
||||
+ (NSString *)randomString:(int)count {
|
||||
if (count>=0) count = 16;
|
||||
//定义一个包含数字,大小写字母的字符串
|
||||
NSString * strAll = @"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
//定义一个结果
|
||||
NSString * result = [[NSMutableString alloc]initWithCapacity:16];
|
||||
for (int i = 0; i < count; i++) {
|
||||
//获取随机数
|
||||
NSInteger index = arc4random() % (strAll.length-1);
|
||||
char tempStr = [strAll characterAtIndex:index];
|
||||
result = (NSMutableString *)[result stringByAppendingString:[NSString stringWithFormat:@"%c",tempStr]];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString *)encodingUrl{
|
||||
NSString *encodedString = @"";
|
||||
if (self ) {
|
||||
encodedString = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
|
||||
(CFStringRef)self,
|
||||
(CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]",
|
||||
NULL,
|
||||
kCFStringEncodingUTF8));
|
||||
}
|
||||
|
||||
return encodedString;
|
||||
}
|
||||
|
||||
- (NSURL *)toUrl{
|
||||
// [self stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"!$&'()*+,-./:;=?@_~%#[]"]];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored"-Wdeprecated-declarations"
|
||||
return [NSURL URLWithString:(NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)self, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL,kCFStringEncodingUTF8))];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
+ (NSString *)signWithParams:(NSDictionary *)params{
|
||||
NSString * signStr = @"";
|
||||
NSArray * sortedKeys = [[params allKeys]sortedArrayUsingSelector:@selector(compare:)];
|
||||
|
||||
for(NSString * key in sortedKeys){
|
||||
id value = [params objectForKey:key] ;
|
||||
NSString * valueStr = @"";
|
||||
if ([value isKindOfClass:[NSArray class]] ) {
|
||||
valueStr = [[self stringWithArray:value] stringByAppendingString:@"}"];
|
||||
}else if ([value isKindOfClass:[NSDictionary class]]){
|
||||
valueStr = [NSString stringWithFormat:@"%@}",[self stringWithDict:value]];
|
||||
}else if ([value isKindOfClass:[NSString class]]){
|
||||
valueStr = value;
|
||||
}
|
||||
NSString * tempKeyV = [NSString stringWithFormat:@"%@=%@&",key,valueStr];
|
||||
signStr = [signStr stringByAppendingFormat:@"%@",tempKeyV];
|
||||
}
|
||||
if (signStr.length >0) {
|
||||
signStr = [signStr substringToIndex:signStr.length-1];
|
||||
}
|
||||
return signStr;
|
||||
}
|
||||
|
||||
+ (NSString*)stringWithArray:(NSArray*)array {
|
||||
NSString*str =@"[";
|
||||
for(id obj in array) {
|
||||
if([obj isKindOfClass:[NSDictionary class]]) {
|
||||
str = [self stringWithDict:obj];
|
||||
str = [str stringByAppendingFormat:@"}"];
|
||||
}else if([obj isKindOfClass:[NSArray class]]) {
|
||||
str = [self stringWithArray:obj];
|
||||
str = [str stringByAppendingFormat:@"]"];
|
||||
}
|
||||
if([str length] !=1) {
|
||||
str = [str stringByAppendingString:@","];
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
+ (NSString*)stringWithDict:(NSDictionary*)dict{
|
||||
NSArray*keys = [dict allKeys];
|
||||
NSArray*sortedArray = [keys sortedArrayUsingComparator:^NSComparisonResult(id obj1,id obj2) {
|
||||
return[obj1 compare:obj2 options:NSNumericSearch];
|
||||
}];
|
||||
|
||||
NSString*str =@"{";
|
||||
for(NSString*categoryId in sortedArray) {
|
||||
id value = [dict objectForKey:categoryId];
|
||||
if([value isKindOfClass:[NSDictionary class]]) {
|
||||
value = [self stringWithDict:value];
|
||||
value = [NSString stringWithFormat:@"%@}",value];
|
||||
} else if([value isKindOfClass:[NSArray class]]) {
|
||||
str = [self stringWithArray:value];
|
||||
str = [str stringByAppendingFormat:@"]"];
|
||||
}
|
||||
if([str length] !=1) {
|
||||
str = [str stringByAppendingString:@","];
|
||||
}
|
||||
str = [str stringByAppendingFormat:@"\"%@\":\"%@\"",categoryId,value];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark --- Validation ---
|
||||
@implementation NSString (Validation)
|
||||
- (BOOL)isPrice{
|
||||
return [self evaluateWithPredicateString:@"(([0]|(0[.]\\d{0,2}))|([1-9]\\d{0,6}(([.]\\d{0,2})?)))?"];
|
||||
}
|
||||
|
||||
- (BOOL)isEmail{
|
||||
return [self evaluateWithPredicateString:@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Za-z]{2,4}"];
|
||||
}
|
||||
|
||||
- (BOOL)isUrl{
|
||||
return [self evaluateWithPredicateString:@"\\bhttps?://[a-zA-Z0-9\\-.]+(?::(\\d+))?(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\\\]*)+)?|([a-zA-Z0-9\\.\\-]+\\.com)?(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\\\]*)+)|([a-zA-Z0-9\\.\\-]+\\.com)"];
|
||||
}
|
||||
|
||||
- (BOOL)isPassword{
|
||||
//以字母开头,只能包含“字母”,“数字”,“下划线”,长度6~18
|
||||
return [self evaluateWithPredicateString:@"^([a-zA-Z]|[a-zA-Z0-9_]|[0-9]){6,18}$"];
|
||||
}
|
||||
|
||||
- (BOOL)isChinese{
|
||||
return [self evaluateWithPredicateString:@"^[\\u4e00-\\u9fa5]+$"];
|
||||
}
|
||||
|
||||
- (BOOL)isMobile{
|
||||
return [self evaluateWithPredicateString:@"^(1)\\d{10}$"];
|
||||
}
|
||||
|
||||
- (BOOL)isPayPassword {
|
||||
return [self evaluateWithPredicateString:@"([0-9]\\d{0,5})?"];
|
||||
}
|
||||
|
||||
- (BOOL)evaluateWithPredicateString:(NSString *)predicate{
|
||||
return [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", predicate] evaluateWithObject:self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark --- Empty ---
|
||||
@implementation NSString (Empty)
|
||||
|
||||
+ (BOOL)empty:(NSString *)string {
|
||||
if (string == nil) return YES;
|
||||
else return [string empty];
|
||||
}
|
||||
|
||||
- (BOOL)empty{
|
||||
|
||||
if ([self isKindOfClass:[NSNull class]]) return YES;
|
||||
|
||||
else if (self.length == 0) return YES;
|
||||
|
||||
else if ([self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length == 0) return YES;
|
||||
|
||||
else return NO;
|
||||
}
|
||||
|
||||
- (NSString *)safeString{
|
||||
if([self empty]) return @"";
|
||||
else return self;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark --- Encrypt ---
|
||||
@implementation NSString (Encrypt)
|
||||
- (NSString *)SHA256String {
|
||||
const char *string = self.UTF8String;
|
||||
int length = (int)strlen(string);
|
||||
unsigned char bytes[CC_SHA256_DIGEST_LENGTH];
|
||||
CC_SHA256(string, length, bytes);
|
||||
return [self stringFromBytes:bytes length:CC_SHA256_DIGEST_LENGTH];
|
||||
}
|
||||
|
||||
/// 字符串是否为空
|
||||
- (NSString *)SHA256WithKey:(NSString *)key {
|
||||
NSData *keyData = [key dataUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
NSData *messageData = [self dataUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
NSMutableData *mutableData = [NSMutableData dataWithLength:CC_SHA256_DIGEST_LENGTH];
|
||||
|
||||
CCHmac(kCCHmacAlgSHA256, keyData.bytes, keyData.length, messageData.bytes, messageData.length, mutableData.mutableBytes);
|
||||
|
||||
return [self stringFromBytes:(unsigned char *)mutableData.bytes length:mutableData.length];
|
||||
}
|
||||
|
||||
- (NSString *)stringFromBytes:(unsigned char *)bytes length:(int)length {
|
||||
NSMutableString *mutableString = @"".mutableCopy;
|
||||
for (int i = 0; i < length; i++) [mutableString appendFormat:@"%02x", bytes[i]];
|
||||
return [NSString stringWithString:mutableString];
|
||||
}
|
||||
|
||||
|
||||
@end
|
24
HiBit/Utils/Category/NSString/NSString+Tools.h
Normal file
24
HiBit/Utils/Category/NSString/NSString+Tools.h
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// NSString+Tools.h
|
||||
// LVTravel
|
||||
//
|
||||
// Created by LOSER on 2020/6/16.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSString (Tools)
|
||||
|
||||
/// 计算字符串的大小
|
||||
/// @param font 字体
|
||||
/// @param width 控件宽度
|
||||
- (CGSize)sizeWithFont:(UIFont*)font width:(CGFloat)width;
|
||||
|
||||
+ (NSString *)convertTimeSecond:(NSInteger)timeSecond;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
33
HiBit/Utils/Category/NSString/NSString+Tools.m
Normal file
33
HiBit/Utils/Category/NSString/NSString+Tools.m
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// NSString+Tools.m
|
||||
// LVTravel
|
||||
//
|
||||
// Created by LOSER on 2020/6/16.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSString+Tools.h"
|
||||
|
||||
@implementation NSString (Tools)
|
||||
- (CGSize)sizeWithFont:(UIFont*)font width:(CGFloat)width{
|
||||
NSStringDrawingOptions options = (NSStringDrawingOptions)(NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin);
|
||||
return [self boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX)
|
||||
options:options
|
||||
attributes:@{NSFontAttributeName: font}
|
||||
context:NULL].size;
|
||||
|
||||
}
|
||||
+ (NSString *)convertTimeSecond:(NSInteger)timeSecond {
|
||||
NSString *theLastTime = nil;
|
||||
long second = timeSecond;
|
||||
if (timeSecond < 60) {
|
||||
theLastTime = [NSString stringWithFormat:@"00:%02zd", second];
|
||||
}else if (timeSecond >= 60 && timeSecond < 3600) {
|
||||
theLastTime = [NSString stringWithFormat:@"%02zd:%02zd", second/60, second%60];
|
||||
}else if (timeSecond >= 3600) {
|
||||
theLastTime = [NSString stringWithFormat:@"%02zd:%02zd:%02zd", second/3600, second%3600/60, second%60];
|
||||
}
|
||||
return theLastTime;
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,33 @@
|
||||
//
|
||||
// NSUserDefaults+Extesion.h
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/9/7.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSUserDefaults (Extesion)
|
||||
+ (void)setBool:(BOOL)value forKey:(NSString *)key;
|
||||
|
||||
+ (void)setObject:(id)object forKey:(NSString *)key;
|
||||
|
||||
+ (BOOL)boolForKey:(NSString *)key;
|
||||
|
||||
+ (void)removeObjectForKey:(NSString *)defaultName;
|
||||
|
||||
+ (NSString *)stringForKey:(NSString *)key;
|
||||
|
||||
+ (NSInteger)integerForKey:(NSString *)key;
|
||||
|
||||
+ (float)floatForKey:(NSString *)key;
|
||||
|
||||
+ (double)doubleForKey:(NSString *)key;
|
||||
|
||||
+ (BOOL)synchronize;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -0,0 +1,50 @@
|
||||
//
|
||||
// NSUserDefaults+Extesion.m
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/9/7.
|
||||
//
|
||||
|
||||
#import "NSUserDefaults+Extesion.h"
|
||||
|
||||
@implementation NSUserDefaults (Extesion)
|
||||
+ (void)setBool:(BOOL)value forKey:(NSString *)key {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:value forKey:key];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
+ (void)setObject:(id)value forKey:(NSString *)key {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
+ (void)removeObjectForKey:(NSString *)defaultName {
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:defaultName];
|
||||
}
|
||||
|
||||
|
||||
+ (BOOL)boolForKey:(NSString *)key {
|
||||
return [[NSUserDefaults standardUserDefaults]boolForKey:key];
|
||||
}
|
||||
|
||||
+ (NSString *)stringForKey:(NSString *)key {
|
||||
return [[NSUserDefaults standardUserDefaults]stringForKey:key];
|
||||
}
|
||||
|
||||
+ (NSInteger)integerForKey:(NSString *)key {
|
||||
return [[NSUserDefaults standardUserDefaults]integerForKey:key];
|
||||
}
|
||||
|
||||
+ (float)floatForKey:(NSString *)key {
|
||||
return [[NSUserDefaults standardUserDefaults]floatForKey:key];
|
||||
}
|
||||
|
||||
+ (double)doubleForKey:(NSString *)key {
|
||||
return [[NSUserDefaults standardUserDefaults]doubleForKey:key];
|
||||
}
|
||||
|
||||
+ (BOOL)synchronize {
|
||||
return [[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
@end
|
42
HiBit/Utils/Category/UIColor/UIColor+Category.h
Normal file
42
HiBit/Utils/Category/UIColor/UIColor+Category.h
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// UIColor+Category.h
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/2/20.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIColor (Category)
|
||||
|
||||
|
||||
/// 读取颜色的16进制 忽略透明度
|
||||
- (NSString *)hexString;
|
||||
|
||||
/// 设置颜色的透明度
|
||||
/// @param alpha 透明度
|
||||
- (UIColor* )alpha:(CGFloat)alpha;
|
||||
|
||||
/// 16进制颜色 透明度默认 1.0
|
||||
/// @param hex 颜色值
|
||||
+ (UIColor *)colorWithHexString:(NSString *)hex;
|
||||
|
||||
/// 16进制颜色
|
||||
/// @param hex 颜色值
|
||||
/// @param alpha 透明度
|
||||
+ (UIColor *)colorWithHexString:(NSString *)hex alpha:(CGFloat)alpha;
|
||||
|
||||
/// 适配黑暗模式 iOS 13.0
|
||||
/// @param lightColor 白天显示的颜色
|
||||
/// @param darkColor 黑夜s显示的颜色
|
||||
+ (UIColor *)colorWithLightColor:(UIColor *)lightColor darkColor:(UIColor *)darkColor;
|
||||
|
||||
/// 随机色
|
||||
+ (UIColor *)randomColor;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
97
HiBit/Utils/Category/UIColor/UIColor+Category.m
Normal file
97
HiBit/Utils/Category/UIColor/UIColor+Category.m
Normal file
@ -0,0 +1,97 @@
|
||||
//
|
||||
// UIColor+Category.m
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/2/20.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIColor+Category.h"
|
||||
|
||||
@implementation UIColor (Category)
|
||||
+ (UIColor *)colorWithHexString:(NSString *)color {
|
||||
return [self colorWithHexString:color alpha:1.0];
|
||||
}
|
||||
|
||||
+ (UIColor *)colorWithHexString:(NSString *)hex alpha:(CGFloat)alpha {
|
||||
//删除字符串中的空格
|
||||
NSString *cString =
|
||||
[[hex stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
|
||||
// String should be 6 or 8 characters
|
||||
if ([cString length] < 6) {
|
||||
return [UIColor clearColor];
|
||||
}
|
||||
// strip 0X if it appears
|
||||
//如果是0x开头的,那么截取字符串,字符串从索引为2的位置开始,一直到末尾
|
||||
if ([cString hasPrefix:@"0X"]) {
|
||||
cString = [cString substringFromIndex:2];
|
||||
}
|
||||
//如果是#开头的,那么截取字符串,字符串从索引为1的位置开始,一直到末尾
|
||||
if ([cString hasPrefix:@"#"]) {
|
||||
cString = [cString substringFromIndex:1];
|
||||
}
|
||||
if ([cString length] != 6) {
|
||||
return [UIColor clearColor];
|
||||
}
|
||||
|
||||
// Separate into r, g, b substrings
|
||||
NSRange range;
|
||||
range.location = 0;
|
||||
range.length = 2;
|
||||
// r
|
||||
NSString *rString = [cString substringWithRange:range];
|
||||
// g
|
||||
range.location = 2;
|
||||
NSString *gString = [cString substringWithRange:range];
|
||||
// b
|
||||
range.location = 4;
|
||||
NSString *bString = [cString substringWithRange:range];
|
||||
|
||||
// Scan values
|
||||
unsigned int r, g, b;
|
||||
[[NSScanner scannerWithString:rString] scanHexInt:&r];
|
||||
[[NSScanner scannerWithString:gString] scanHexInt:&g];
|
||||
[[NSScanner scannerWithString:bString] scanHexInt:&b];
|
||||
return [UIColor colorWithRed:((float)r / 255.0f) green:((float)g / 255.0f) blue:((float)b / 255.0f) alpha:alpha];
|
||||
}
|
||||
|
||||
- (NSString *)hexString {
|
||||
NSInteger cpts = CGColorGetNumberOfComponents(self.CGColor);
|
||||
const CGFloat *components = CGColorGetComponents(self.CGColor);
|
||||
CGFloat r = components[0];//红色
|
||||
CGFloat g = components[1];//绿色
|
||||
CGFloat b = components[2];//蓝色
|
||||
return [NSString stringWithFormat:@"#%02lX%02lX%02lX", lroundf(r * 255), lroundf(g * 255), lroundf(b * 255)];
|
||||
}
|
||||
|
||||
- (UIColor* )alpha:(CGFloat)alpha {
|
||||
return [UIColor colorWithHexString:[self hexString]
|
||||
alpha:alpha];
|
||||
}
|
||||
|
||||
|
||||
|
||||
+ (UIColor *)colorWithLightColor:(UIColor *)lightColor darkColor:(UIColor *)darkColor{
|
||||
if (@available(iOS 13.0, *)){
|
||||
return [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
|
||||
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
|
||||
return lightColor;
|
||||
}else if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||
return darkColor;
|
||||
}else{
|
||||
return lightColor;
|
||||
}
|
||||
}];
|
||||
}
|
||||
return lightColor;
|
||||
}
|
||||
|
||||
+ (UIColor *)randomColor {
|
||||
return [UIColor colorWithRed:arc4random_uniform(256)/255.0
|
||||
green:arc4random_uniform(256)/255.0
|
||||
blue:arc4random_uniform(256)/255.0
|
||||
alpha:1.0];
|
||||
}
|
||||
|
||||
|
||||
@end
|
17
HiBit/Utils/Category/UIControl/UIControl+Extension.h
Normal file
17
HiBit/Utils/Category/UIControl/UIControl+Extension.h
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// UIControl+Extension.h
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/10/18.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
FOUNDATION_EXPORT NSString * NSStringFromControlState(UIControlState status);
|
||||
|
||||
@interface UIControl (Extension)
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
33
HiBit/Utils/Category/UIControl/UIControl+Extension.m
Normal file
33
HiBit/Utils/Category/UIControl/UIControl+Extension.m
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// UIControl+Extension.m
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/10/18.
|
||||
//
|
||||
|
||||
#import "UIControl+Extension.h"
|
||||
|
||||
NSString * NSStringFromControlState(UIControlState status) {
|
||||
switch (status) {
|
||||
case UIControlStateNormal:
|
||||
return @"Normal";
|
||||
case UIControlStateSelected:
|
||||
return @"Selected";
|
||||
case UIControlStateDisabled:
|
||||
return @"Disabled";
|
||||
case UIControlStateHighlighted:
|
||||
return @"Highlighted";
|
||||
case UIControlStateFocused:
|
||||
return @"Focused";
|
||||
case UIControlStateApplication:
|
||||
return @"Application";
|
||||
case UIControlStateReserved:
|
||||
return @"Reserved";
|
||||
default:
|
||||
return @"Other";
|
||||
}
|
||||
}
|
||||
|
||||
@implementation UIControl (Extension)
|
||||
|
||||
@end
|
57
HiBit/Utils/Category/UIDevice/UIDevice+Extension.h
Normal file
57
HiBit/Utils/Category/UIDevice/UIDevice+Extension.h
Normal file
@ -0,0 +1,57 @@
|
||||
//
|
||||
// UIDevice+Extension.h
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/8/30.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIDevice (Extension)
|
||||
/// 设备名称
|
||||
+ (NSString *)deviceName;
|
||||
|
||||
/// 设备系统名
|
||||
+ (NSString *)systemName;
|
||||
|
||||
/// 设备系统版本号
|
||||
+ (NSString *)systemVersion;
|
||||
|
||||
/// 设备机型
|
||||
+ (NSString *)model;
|
||||
|
||||
/// 设备方向
|
||||
+ (UIDeviceOrientation)orientation;
|
||||
|
||||
/// app name
|
||||
+ (NSString *) appName;
|
||||
|
||||
/// app 版本
|
||||
+ (NSString* )appVersion;
|
||||
|
||||
/// build 版本
|
||||
+ (NSString* )bundleVersion;
|
||||
|
||||
/// bundle Id
|
||||
+ (NSString *) bundleIdentifier;
|
||||
|
||||
/// 供应商标识符
|
||||
+ (NSString *)identifierForVendor;
|
||||
|
||||
/// mac 地址
|
||||
+ (NSString *) macAddress;
|
||||
|
||||
/// IP 地址
|
||||
+ (NSString *)ipAddress;
|
||||
|
||||
/// 设备机型
|
||||
+ (NSString *)deviceModel;
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
257
HiBit/Utils/Category/UIDevice/UIDevice+Extension.m
Normal file
257
HiBit/Utils/Category/UIDevice/UIDevice+Extension.m
Normal file
@ -0,0 +1,257 @@
|
||||
//
|
||||
// UIDevice+Extension.m
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/8/30.
|
||||
//
|
||||
|
||||
#import "UIDevice+Extension.h"
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
|
||||
@implementation UIDevice (Extension)
|
||||
|
||||
/// 设备名称
|
||||
+ (NSString *)deviceName {
|
||||
return [UIDevice currentDevice].name;
|
||||
}
|
||||
|
||||
/// 设备系统名
|
||||
+ (NSString *)systemName {
|
||||
return [UIDevice currentDevice].systemName;
|
||||
}
|
||||
|
||||
/// 设备系统版本号
|
||||
+ (NSString *)systemVersion {
|
||||
return [UIDevice currentDevice].systemVersion;
|
||||
}
|
||||
|
||||
/// 设备机型
|
||||
+ (NSString *)model {
|
||||
return [UIDevice currentDevice].model;
|
||||
}
|
||||
|
||||
/// 设备方向
|
||||
+ (UIDeviceOrientation)orientation {
|
||||
return [UIDevice currentDevice].orientation;
|
||||
}
|
||||
|
||||
|
||||
/// app name
|
||||
+ (NSString *) appName {
|
||||
return [NSBundle mainBundle].infoDictionary[@"CFBundleDisplayName"];
|
||||
}
|
||||
|
||||
/// app 版本
|
||||
+ (NSString* )appVersion {
|
||||
return [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
|
||||
}
|
||||
|
||||
/// build 版本
|
||||
+ (NSString* )bundleVersion {
|
||||
return [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
|
||||
}
|
||||
|
||||
/// bundle Id
|
||||
+ (NSString *) bundleIdentifier {
|
||||
return [NSBundle mainBundle].bundleIdentifier;
|
||||
}
|
||||
|
||||
/// 供应商标识符
|
||||
+ (NSString *)identifierForVendor {
|
||||
return [[UIDevice currentDevice].identifierForVendor UUIDString];
|
||||
}
|
||||
|
||||
|
||||
/// mac 地址
|
||||
+ (NSString *) macAddress {
|
||||
|
||||
int mib[6];
|
||||
size_t len;
|
||||
char *buf;
|
||||
unsigned char *ptr;
|
||||
struct if_msghdr *ifm;
|
||||
struct sockaddr_dl *sdl;
|
||||
|
||||
mib[0] = CTL_NET;
|
||||
mib[1] = AF_ROUTE;
|
||||
mib[2] = 0;
|
||||
mib[3] = AF_LINK;
|
||||
mib[4] = NET_RT_IFLIST;
|
||||
|
||||
if ((mib[5] = if_nametoindex("en0")) == 0) {
|
||||
printf("Error: if_nametoindex error/n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) {
|
||||
printf("Error: sysctl, take 1/n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((buf = malloc(len)) == NULL) {
|
||||
printf("Could not allocate memory. error!/n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) {
|
||||
printf("Error: sysctl, take 2");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ifm = (struct if_msghdr *)buf;
|
||||
sdl = (struct sockaddr_dl *)(ifm + 1);
|
||||
ptr = (unsigned char *)LLADDR(sdl);
|
||||
NSString *outstring = [NSString stringWithFormat:@"%02x:%02x:%02x:%02x:%02x:%02x", *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), *(ptr+5)];
|
||||
|
||||
free(buf);
|
||||
|
||||
return [outstring uppercaseString];
|
||||
}
|
||||
|
||||
/// IP 地址
|
||||
+ (NSString *)ipAddress {
|
||||
NSString *ipAdrress = nil;
|
||||
NSError *error;
|
||||
NSURL *ipURL = [NSURL URLWithString:@"http://pv.sohu.com/cityjson?ie=utf-8"];
|
||||
NSString *str = [NSString stringWithContentsOfURL:ipURL encoding:NSUTF8StringEncoding error:&error];
|
||||
|
||||
if (str.length > 0) {
|
||||
NSArray *arr = [str componentsSeparatedByString:@"="];
|
||||
NSString *json = [arr lastObject];
|
||||
|
||||
NSRange startRange = [json rangeOfString:@"{"];
|
||||
|
||||
NSRange endRange = [json rangeOfString:@"}"];
|
||||
|
||||
NSRange range = NSMakeRange(startRange.location + startRange.length-1, endRange.location - startRange.location - startRange.length+2);
|
||||
|
||||
NSString *result = [json substringWithRange:range];
|
||||
|
||||
NSData *jsonData = [result dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSError *err;
|
||||
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
|
||||
options:NSJSONReadingMutableContainers
|
||||
error:&err];
|
||||
if(err) {
|
||||
NSLog(@"json解析失败:%@",err);
|
||||
ipAdrress = @"0.0.0.0";
|
||||
}
|
||||
ipAdrress = dic[@"cip"];
|
||||
}
|
||||
|
||||
if (ipAdrress.length == 0) {
|
||||
ipAdrress = @"0.0.0.0";
|
||||
}
|
||||
return ipAdrress;
|
||||
}
|
||||
|
||||
/// 设备机型
|
||||
+ (NSString *)deviceModel{
|
||||
struct utsname systemInfo;
|
||||
uname(&systemInfo);
|
||||
|
||||
NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSASCIIStringEncoding];
|
||||
|
||||
if ([deviceModel isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
|
||||
if ([deviceModel isEqualToString:@"iPhone3,2"]) return @"iPhone 4";
|
||||
if ([deviceModel isEqualToString:@"iPhone3,3"]) return @"iPhone 4";
|
||||
if ([deviceModel isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
|
||||
if ([deviceModel isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
|
||||
if ([deviceModel isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (GSM+CDMA)";
|
||||
if ([deviceModel isEqualToString:@"iPhone5,3"]) return @"iPhone 5c (GSM)";
|
||||
if ([deviceModel isEqualToString:@"iPhone5,4"]) return @"iPhone 5c (GSM+CDMA)";
|
||||
if ([deviceModel isEqualToString:@"iPhone6,1"]) return @"iPhone 5s (GSM)";
|
||||
if ([deviceModel isEqualToString:@"iPhone6,2"]) return @"iPhone 5s (GSM+CDMA)";
|
||||
if ([deviceModel isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
|
||||
if ([deviceModel isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
|
||||
if ([deviceModel isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
|
||||
if ([deviceModel isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
|
||||
if ([deviceModel isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
|
||||
// 日行两款手机型号均为日本独占,可能使用索尼FeliCa支付方案而不是苹果支付
|
||||
if ([deviceModel isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
|
||||
if ([deviceModel isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
|
||||
if ([deviceModel isEqualToString:@"iPhone9,3"]) return @"iPhone 7";
|
||||
if ([deviceModel isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";
|
||||
if ([deviceModel isEqualToString:@"iPhone10,1"]) return @"iPhone_8";
|
||||
if ([deviceModel isEqualToString:@"iPhone10,4"]) return @"iPhone_8";
|
||||
if ([deviceModel isEqualToString:@"iPhone10,2"]) return @"iPhone_8_Plus";
|
||||
if ([deviceModel isEqualToString:@"iPhone10,5"]) return @"iPhone_8_Plus";
|
||||
if ([deviceModel isEqualToString:@"iPhone10,3"]) return @"iPhone X";
|
||||
if ([deviceModel isEqualToString:@"iPhone10,6"]) return @"iPhone X";
|
||||
if ([deviceModel isEqualToString:@"iPhone11,8"]) return @"iPhone XR";
|
||||
if ([deviceModel isEqualToString:@"iPhone11,2"]) return @"iPhone XS";
|
||||
if ([deviceModel isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max";
|
||||
if ([deviceModel isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max";
|
||||
if ([deviceModel isEqualToString:@"iPhone12,1"]) return @"iPhone 11";
|
||||
if ([deviceModel isEqualToString:@"iPhone12,3"]) return @"iPhone 11 Pro";
|
||||
if ([deviceModel isEqualToString:@"iPhone12,5"]) return @"iPhone 11 Pro Max";
|
||||
if ([deviceModel isEqualToString:@"iPhone12,8"]) return @"iPhone SE2";
|
||||
if ([deviceModel isEqualToString:@"iPhone13,1"]) return @"iPhone 12 mini";
|
||||
if ([deviceModel isEqualToString:@"iPhone13,2"]) return @"iPhone 12";
|
||||
if ([deviceModel isEqualToString:@"iPhone13,3"]) return @"iPhone 12 Pro";
|
||||
if ([deviceModel isEqualToString:@"iPhone14,4"]) return @"iPhone 13 Min";
|
||||
if ([deviceModel isEqualToString:@"iPhone14,5"]) return @"iPhone 13";
|
||||
if ([deviceModel isEqualToString:@"iPhone14,2"]) return @"iPhone 13 Pro";
|
||||
if ([deviceModel isEqualToString:@"iPhone14,3"]) return @"iPhone 13 Pro Max";
|
||||
if ([deviceModel isEqualToString:@"iPhone14,6"]) return @"iPhone SE3";
|
||||
if ([deviceModel isEqualToString:@"iPhone14,7"]) return @"iPhone 14";
|
||||
if ([deviceModel isEqualToString:@"iPhone14,8"]) return @"iPhone 14 Plus";
|
||||
if ([deviceModel isEqualToString:@"iPhone15,2"]) return @"iPhone 14 Pro";
|
||||
if ([deviceModel isEqualToString:@"iPhone15,3"]) return @"iPhone 14 Pro Max";
|
||||
if ([deviceModel isEqualToString:@"iPhone15,4"]) return @"iPhone 15";
|
||||
if ([deviceModel isEqualToString:@"iPhone15,5"]) return @"iPhone 15 Plus";
|
||||
if ([deviceModel isEqualToString:@"iPhone16,1"]) return @"iPhone 15 Pro";
|
||||
if ([deviceModel isEqualToString:@"iPhone16,2"]) return @"iPhone 15 Pro Max";
|
||||
|
||||
if ([deviceModel isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G";
|
||||
if ([deviceModel isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G";
|
||||
if ([deviceModel isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G";
|
||||
if ([deviceModel isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G";
|
||||
if ([deviceModel isEqualToString:@"iPod5,1"]) return @"iPod Touch (5 Gen)";
|
||||
if ([deviceModel isEqualToString:@"iPad1,1"]) return @"iPad";
|
||||
if ([deviceModel isEqualToString:@"iPad1,2"]) return @"iPad 3G";
|
||||
if ([deviceModel isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)";
|
||||
if ([deviceModel isEqualToString:@"iPad2,2"]) return @"iPad 2";
|
||||
if ([deviceModel isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)";
|
||||
if ([deviceModel isEqualToString:@"iPad2,4"]) return @"iPad 2";
|
||||
if ([deviceModel isEqualToString:@"iPad2,5"]) return @"iPad Mini (WiFi)";
|
||||
if ([deviceModel isEqualToString:@"iPad2,6"]) return @"iPad Mini";
|
||||
if ([deviceModel isEqualToString:@"iPad2,7"]) return @"iPad Mini (GSM+CDMA)";
|
||||
if ([deviceModel isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)";
|
||||
if ([deviceModel isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM+CDMA)";
|
||||
if ([deviceModel isEqualToString:@"iPad3,3"]) return @"iPad 3";
|
||||
if ([deviceModel isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)";
|
||||
if ([deviceModel isEqualToString:@"iPad3,5"]) return @"iPad 4";
|
||||
if ([deviceModel isEqualToString:@"iPad3,6"]) return @"iPad 4 (GSM+CDMA)";
|
||||
if ([deviceModel isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)";
|
||||
if ([deviceModel isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)";
|
||||
if ([deviceModel isEqualToString:@"iPad4,4"]) return @"iPad Mini 2 (WiFi)";
|
||||
if ([deviceModel isEqualToString:@"iPad4,5"]) return @"iPad Mini 2 (Cellular)";
|
||||
if ([deviceModel isEqualToString:@"iPad4,6"]) return @"iPad Mini 2";
|
||||
if ([deviceModel isEqualToString:@"iPad4,7"]) return @"iPad Mini 3";
|
||||
if ([deviceModel isEqualToString:@"iPad4,8"]) return @"iPad Mini 3";
|
||||
if ([deviceModel isEqualToString:@"iPad4,9"]) return @"iPad Mini 3";
|
||||
if ([deviceModel isEqualToString:@"iPad5,1"]) return @"iPad Mini 4 (WiFi)";
|
||||
if ([deviceModel isEqualToString:@"iPad5,2"]) return @"iPad Mini 4 (LTE)";
|
||||
if ([deviceModel isEqualToString:@"iPad5,3"]) return @"iPad Air 2";
|
||||
if ([deviceModel isEqualToString:@"iPad5,4"]) return @"iPad Air 2";
|
||||
if ([deviceModel isEqualToString:@"iPad6,3"]) return @"iPad Pro 9.7";
|
||||
if ([deviceModel isEqualToString:@"iPad6,4"]) return @"iPad Pro 9.7";
|
||||
if ([deviceModel isEqualToString:@"iPad6,7"]) return @"iPad Pro 12.9";
|
||||
if ([deviceModel isEqualToString:@"iPad6,8"]) return @"iPad Pro 12.9";
|
||||
|
||||
if ([deviceModel isEqualToString:@"AppleTV2,1"]) return @"Apple TV 2";
|
||||
if ([deviceModel isEqualToString:@"AppleTV3,1"]) return @"Apple TV 3";
|
||||
if ([deviceModel isEqualToString:@"AppleTV3,2"]) return @"Apple TV 3";
|
||||
if ([deviceModel isEqualToString:@"AppleTV5,3"]) return @"Apple TV 4";
|
||||
|
||||
if ([deviceModel isEqualToString:@"i386"]) return @"Simulator";
|
||||
if ([deviceModel isEqualToString:@"x86_64"]) return @"Simulator";
|
||||
return deviceModel;
|
||||
}
|
||||
|
||||
|
||||
@end
|
18
HiBit/Utils/Category/UIFont/UIFont+Category.h
Normal file
18
HiBit/Utils/Category/UIFont/UIFont+Category.h
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// UIFont+Category.h
|
||||
// LVTravel
|
||||
//
|
||||
// Created by LOSER on 2020/5/21.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIFont (Category)
|
||||
+ (UIFont *)font_systemFontOfSize:(CGFloat)fontSize weight:(UIFontWeight)weight;
|
||||
+ (UIFont *)font_systemFontOfSize:(CGFloat)fontSize;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
21
HiBit/Utils/Category/UIFont/UIFont+Category.m
Normal file
21
HiBit/Utils/Category/UIFont/UIFont+Category.m
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// UIFont+Category.m
|
||||
// LVTravel
|
||||
//
|
||||
// Created by LOSER on 2020/5/21.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIFont+Category.h"
|
||||
|
||||
@implementation UIFont (Category)
|
||||
+ (UIFont *)font_systemFontOfSize:(CGFloat)fontSize weight:(UIFontWeight)weight{
|
||||
CGFloat adapt = fontSize * ([[UIScreen mainScreen] bounds].size.width/375.0);
|
||||
return [UIFont systemFontOfSize:adapt weight:weight];
|
||||
|
||||
}
|
||||
+ (UIFont *)font_systemFontOfSize:(CGFloat)fontSize{
|
||||
CGFloat adapt = fontSize * ([[UIScreen mainScreen] bounds].size.width/375.0);
|
||||
return [UIFont systemFontOfSize:adapt];
|
||||
}
|
||||
@end
|
45
HiBit/Utils/Category/UIImage/UIImage+Category.h
Normal file
45
HiBit/Utils/Category/UIImage/UIImage+Category.h
Normal file
@ -0,0 +1,45 @@
|
||||
//
|
||||
// UIImage+Category.h
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/3/6.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
#import <UIKit/UIKit.h>
|
||||
typedef NS_ENUM(NSUInteger, GradientType) {
|
||||
GradientTypeTopToBottom = 0,//从上到下
|
||||
GradientTypeLeftToRight = 1,//从左到右
|
||||
GradientTypeUpleftToLowright = 2,//左上到右下
|
||||
GradientTypeUprightToLowleft = 3,//右上到左下
|
||||
};
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIImage (Category)
|
||||
|
||||
/// 生成渐变色图片
|
||||
/// @param colors 颜色值
|
||||
/// @param gradientType 渐变方向
|
||||
/// @param imgSize size
|
||||
+ (UIImage *)gradientColorImageFromColors:(NSArray*)colors gradientType:(GradientType)gradientType imgSize:(CGSize)imgSize;
|
||||
|
||||
/// 图片
|
||||
/// @param imageNamed 图片名
|
||||
/// @param renderingMode model
|
||||
+ (UIImage *)imageNamed:(NSString *)imageNamed renderingMode:(UIImageRenderingMode)renderingMode;
|
||||
|
||||
/// UIColor 转UIImage
|
||||
/// @param color 颜色
|
||||
+ (UIImage *)imageWithColor:(UIColor *)color;
|
||||
|
||||
|
||||
/// 图片
|
||||
/// @param imageName 图片名字
|
||||
/// @param filePath 图片所在文件夹路劲
|
||||
+ (nullable UIImage *)imageNamed:(NSString *)imageName inResource:(nullable NSString *)filePath;
|
||||
|
||||
/// 图片
|
||||
/// @param imageNamed 图片名字
|
||||
+ (UIImage *)customImageNamed:(NSString *)imageNamed;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
92
HiBit/Utils/Category/UIImage/UIImage+Category.m
Normal file
92
HiBit/Utils/Category/UIImage/UIImage+Category.m
Normal file
@ -0,0 +1,92 @@
|
||||
//
|
||||
// UIImage+Category.m
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/3/6.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIImage+Category.h"
|
||||
|
||||
@implementation UIImage (Category)
|
||||
+ (UIImage *)gradientColorImageFromColors:(NSArray*)colors gradientType:(GradientType)gradientType imgSize:(CGSize)imgSize{
|
||||
NSMutableArray *ar = [NSMutableArray array];
|
||||
for(UIColor *c in colors) {
|
||||
[ar addObject:(id)c.CGColor];
|
||||
}
|
||||
UIGraphicsBeginImageContextWithOptions(imgSize, YES, 1);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
CGContextSaveGState(context);
|
||||
CGColorSpaceRef colorSpace = CGColorGetColorSpace([[colors lastObject] CGColor]);
|
||||
CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)ar, NULL);
|
||||
CGPoint start;
|
||||
CGPoint end;
|
||||
switch (gradientType) {
|
||||
case GradientTypeTopToBottom:
|
||||
start = CGPointMake(0.0, 0.0);
|
||||
end = CGPointMake(0.0, imgSize.height);
|
||||
break;
|
||||
case GradientTypeLeftToRight:
|
||||
start = CGPointMake(0.0, 0.0);
|
||||
end = CGPointMake(imgSize.width, 0.0);
|
||||
break;
|
||||
case GradientTypeUpleftToLowright:
|
||||
start = CGPointMake(0.0, 0.0);
|
||||
end = CGPointMake(imgSize.width, imgSize.height);
|
||||
break;
|
||||
case GradientTypeUprightToLowleft:
|
||||
start = CGPointMake(imgSize.width, 0.0);
|
||||
end = CGPointMake(0.0, imgSize.height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
CGContextDrawLinearGradient(context, gradient, start, end,kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
|
||||
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
CGGradientRelease(gradient);
|
||||
CGContextRestoreGState(context);
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
UIGraphicsEndImageContext();
|
||||
return image;
|
||||
}
|
||||
|
||||
+ (UIImage *)imageNamed:(NSString *)imageNamed renderingMode:(UIImageRenderingMode)renderingMode{
|
||||
return [[UIImage imageNamed:imageNamed] imageWithRenderingMode:renderingMode];
|
||||
}
|
||||
|
||||
|
||||
+ (nullable UIImage *)imageNamed:(NSString *)imageName inResource:(nullable NSString *)filePath {
|
||||
if (!imageName) {
|
||||
return nil;
|
||||
}
|
||||
UIImage *image;
|
||||
|
||||
if (filePath) {
|
||||
filePath = [filePath stringByAppendingPathComponent:imageName];
|
||||
image = [UIImage imageWithContentsOfFile:filePath];
|
||||
}
|
||||
|
||||
if (!image) {
|
||||
image = [self imageNamed:imageName];
|
||||
}
|
||||
return image;
|
||||
|
||||
}
|
||||
|
||||
+ (UIImage *)customImageNamed:(NSString *)imageNamed {
|
||||
NSString * filePath = [[NSBundle mainBundle] pathForResource:@"images" ofType:@"xcassets"];
|
||||
return [self imageNamed:imageNamed inResource:filePath];
|
||||
}
|
||||
|
||||
|
||||
+ (UIImage *)imageWithColor:(UIColor *)color {
|
||||
CGRect rect = CGRectMake(0, 0, 1, 1);
|
||||
UIGraphicsBeginImageContext(rect.size);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
CGContextSetFillColorWithColor(context, [color CGColor]);
|
||||
CGContextFillRect(context, rect);
|
||||
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return theImage;
|
||||
}
|
||||
@end
|
17
HiBit/Utils/Category/UIImageView/UIImageView+Extension.h
Normal file
17
HiBit/Utils/Category/UIImageView/UIImageView+Extension.h
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// UIImageView+Extension.h
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/9/13.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIImageView (Extension)
|
||||
+ (instancetype)imageNamed:(NSString *)imageNamed;
|
||||
+ (instancetype)image:(UIImage *)image;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
18
HiBit/Utils/Category/UIImageView/UIImageView+Extension.m
Normal file
18
HiBit/Utils/Category/UIImageView/UIImageView+Extension.m
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// UIImageView+Extension.m
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/9/13.
|
||||
//
|
||||
|
||||
#import "UIImageView+Extension.h"
|
||||
|
||||
@implementation UIImageView (Extension)
|
||||
+ (instancetype)imageNamed:(NSString *)imageNamed{
|
||||
return [self image:[UIImage imageNamed:imageNamed]];
|
||||
}
|
||||
|
||||
+ (instancetype)image:(UIImage *)image {
|
||||
return [[UIImageView alloc]initWithImage:image];
|
||||
}
|
||||
@end
|
47
HiBit/Utils/Category/UIScreen/UIScreen+Extension.h
Normal file
47
HiBit/Utils/Category/UIScreen/UIScreen+Extension.h
Normal file
@ -0,0 +1,47 @@
|
||||
//
|
||||
// UIScreen+Extension.h
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/8/30.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIScreen (Extension)
|
||||
|
||||
+ (CGFloat)scale;
|
||||
|
||||
+ (CGRect)bounds;
|
||||
|
||||
+ (CGSize)size;
|
||||
|
||||
+ (CGFloat)width;
|
||||
|
||||
+ (CGFloat)height;
|
||||
|
||||
/// 屏幕宽度比例 参照屏幕宽度 375.0
|
||||
+ (CGFloat)widthRatio;
|
||||
|
||||
+ (CGFloat)adapteWidth:(CGFloat) width;
|
||||
|
||||
/// 屏幕高度比例 参照屏幕高度 667.0
|
||||
+ (CGFloat)heightRatio;
|
||||
|
||||
+ (CGFloat)adapteHeight:(CGFloat) height;
|
||||
|
||||
/// 是否有安全区域
|
||||
+ (BOOL)hasSafeArea;
|
||||
|
||||
/// 导航栏高度
|
||||
+ (CGFloat)navgationBarHeight;
|
||||
|
||||
/// 状态栏高度
|
||||
+ (CGFloat)statusBarHeight;
|
||||
|
||||
+ (CGFloat)bottomSafeHeight;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
95
HiBit/Utils/Category/UIScreen/UIScreen+Extension.m
Normal file
95
HiBit/Utils/Category/UIScreen/UIScreen+Extension.m
Normal file
@ -0,0 +1,95 @@
|
||||
//
|
||||
// UIScreen+Extension.m
|
||||
// Serendipity
|
||||
//
|
||||
// Created by HI_LOSER on 2022/8/30.
|
||||
//
|
||||
|
||||
#import "UIScreen+Extension.h"
|
||||
|
||||
@implementation UIScreen (Extension)
|
||||
|
||||
+ (CGFloat)scale {
|
||||
return [UIScreen mainScreen].scale;
|
||||
}
|
||||
|
||||
+ (CGRect) bounds {
|
||||
return [UIScreen mainScreen].bounds;
|
||||
}
|
||||
|
||||
+ (CGSize) size {
|
||||
return [self bounds].size;
|
||||
}
|
||||
|
||||
+ (CGFloat) width {
|
||||
return [self size].width;
|
||||
}
|
||||
|
||||
+ (CGFloat) height {
|
||||
return [self size].height;
|
||||
}
|
||||
|
||||
/// 屏幕宽度比例 参照屏幕宽度 375.0
|
||||
+ (CGFloat) widthRatio {
|
||||
return [self width] / 375.0;
|
||||
}
|
||||
|
||||
+ (CGFloat)adapteWidth:(CGFloat) width {
|
||||
return width * [self widthRatio];
|
||||
}
|
||||
|
||||
/// 屏幕高度比例 参照屏幕高度 667.0
|
||||
+ (CGFloat) heightRatio {
|
||||
return [self height] / 667.0;
|
||||
}
|
||||
|
||||
+ (CGFloat)adapteHeight:(CGFloat) height {
|
||||
return height * [self heightRatio];
|
||||
}
|
||||
|
||||
+ (BOOL)hasSafeArea {
|
||||
|
||||
if ([UIDevice currentDevice].userInterfaceIdiom != UIUserInterfaceIdiomPhone) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
if ([UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom > 0.0) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
|
||||
}
|
||||
/// 导航栏高度
|
||||
+ (CGFloat)navgationBarHeight {
|
||||
return 44 + [self statusBarHeight];
|
||||
}
|
||||
|
||||
/// 状态栏高度
|
||||
+ (CGFloat)statusBarHeight {
|
||||
|
||||
if (@available(iOS 13.0, *)) {
|
||||
NSSet *set = [UIApplication sharedApplication].connectedScenes;
|
||||
UIWindowScene *windowScene = [set anyObject];
|
||||
UIStatusBarManager *statusBarManager = windowScene.statusBarManager;
|
||||
return statusBarManager.statusBarFrame.size.height;
|
||||
} else {
|
||||
return [UIApplication sharedApplication].statusBarFrame.size.height;
|
||||
}
|
||||
}
|
||||
|
||||
+ (CGFloat)bottomSafeHeight{
|
||||
if (@available(iOS 13.0, *)) {
|
||||
NSSet *set = [UIApplication sharedApplication].connectedScenes;
|
||||
UIWindowScene *windowScene = [set anyObject];
|
||||
UIWindow *window = windowScene.windows.firstObject;
|
||||
return window.safeAreaInsets.bottom;
|
||||
} else if (@available(iOS 11.0, *)) {
|
||||
UIWindow *window = [UIApplication sharedApplication].windows.firstObject;
|
||||
return window.safeAreaInsets.bottom;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@end
|
31
HiBit/Utils/Category/UITableView/UITableView+Extension.h
Normal file
31
HiBit/Utils/Category/UITableView/UITableView+Extension.h
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// UITableView+Extension.h
|
||||
// whale
|
||||
//
|
||||
// Created by LOSER on 2020/11/24.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UITableView (Extension)
|
||||
|
||||
/// 根据 XIB's class 注册 cell
|
||||
/// @param cls class
|
||||
- (void)registerNibWithClass:(Class)cls;
|
||||
|
||||
/// 根据 class 注册 cell
|
||||
/// @param cls class
|
||||
- (void)registerWithClass:(Class)cls;
|
||||
|
||||
/// 根据 XIB's class 注册 header footer view
|
||||
/// @param cls class
|
||||
- (void)registerHeaderFooterNibWithClass:(Class)cls;
|
||||
|
||||
/// 根据 class 注册 header footer view
|
||||
/// @param cls class
|
||||
- (void)registerHeaderFooterWithClass:(Class)cls;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
31
HiBit/Utils/Category/UITableView/UITableView+Extension.m
Normal file
31
HiBit/Utils/Category/UITableView/UITableView+Extension.m
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// UITableView+Extension.m
|
||||
// whale
|
||||
//
|
||||
// Created by LOSER on 2020/11/24.
|
||||
//
|
||||
|
||||
#import "UITableView+Extension.h"
|
||||
|
||||
@implementation UITableView (Extension)
|
||||
|
||||
- (void)registerNibWithClass:(Class)cls{
|
||||
NSString * name = NSStringFromClass(cls);
|
||||
[self registerNib: [UINib nibWithNibName:name bundle:nil] forCellReuseIdentifier:name];
|
||||
}
|
||||
|
||||
- (void)registerWithClass:(Class)cls{
|
||||
NSString * name = NSStringFromClass(cls);
|
||||
[self registerClass:cls forCellReuseIdentifier:name];
|
||||
}
|
||||
|
||||
- (void)registerHeaderFooterNibWithClass:(Class)cls{
|
||||
NSString * name = NSStringFromClass(cls);
|
||||
[self registerNib:[UINib nibWithNibName:name bundle:nil] forHeaderFooterViewReuseIdentifier:name];
|
||||
}
|
||||
|
||||
- (void)registerHeaderFooterWithClass:(Class)cls{
|
||||
NSString * name = NSStringFromClass(cls);
|
||||
[self registerClass:cls forHeaderFooterViewReuseIdentifier:name];
|
||||
}
|
||||
@end
|
18
HiBit/Utils/Category/UITextField/UITextField+Category.h
Normal file
18
HiBit/Utils/Category/UITextField/UITextField+Category.h
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// UITextField+Category.h
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/2/26.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UITextField (Category)
|
||||
@property (strong, nonatomic) UIColor * placeHolderColor;
|
||||
@property (strong, nonatomic) UIFont * placeHolderFont;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
71
HiBit/Utils/Category/UITextField/UITextField+Category.m
Normal file
71
HiBit/Utils/Category/UITextField/UITextField+Category.m
Normal file
@ -0,0 +1,71 @@
|
||||
//
|
||||
// UITextField+Category.m
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/2/26.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UITextField+Category.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
static char placeHolderColorkey;
|
||||
static char placeHolderFontkey;
|
||||
|
||||
@implementation UITextField (Category)
|
||||
|
||||
-(void)setPlaceHolderColor:(UIColor *)placeHolderColor{
|
||||
if (@available(iOS 13.0, *)){
|
||||
Ivar ivar2 = class_getInstanceVariable([UITextField class], "_placeholderLabel");
|
||||
UILabel *placeholderLabel = object_getIvar(self, ivar2);
|
||||
placeholderLabel.textColor = placeHolderColor;
|
||||
|
||||
}else{
|
||||
[self setValue:placeHolderColor forKeyPath:@"_placeholderLabel.textColor"];
|
||||
}
|
||||
objc_setAssociatedObject(self, &placeHolderColorkey, placeHolderColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
- (UIColor *)placeHolderColor{
|
||||
UIColor * color = objc_getAssociatedObject(self, &placeHolderColorkey);
|
||||
|
||||
if (color == nil) {
|
||||
color = [UIColor darkGrayColor];
|
||||
}
|
||||
return color;
|
||||
}
|
||||
-(void)setPlaceHolderFont:(UIFont *)placeHolderFont {
|
||||
if (@available(iOS 13.0, *)){
|
||||
Ivar ivar2 = class_getInstanceVariable([UITextField class], "_placeholderLabel");
|
||||
UILabel *placeholderLabel = object_getIvar(self, ivar2);
|
||||
placeholderLabel.font = placeHolderFont;
|
||||
|
||||
}else{
|
||||
[self setValue:placeHolderFont forKeyPath:@"_placeholderLabel.font"];
|
||||
}
|
||||
objc_setAssociatedObject(self, &placeHolderFontkey, placeHolderFont, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
- (UIFont *)placeHolderFont{
|
||||
UIFont * font = objc_getAssociatedObject(self, &placeHolderFontkey);
|
||||
|
||||
if (font == nil) {
|
||||
font = self.font;
|
||||
}
|
||||
return font;
|
||||
}
|
||||
|
||||
- (void)didMoveToWindow{
|
||||
[super didMoveToWindow];
|
||||
// if (@available(iOS 11.0, *)) {
|
||||
// NSString *keyPath = @"textContentView.provider";
|
||||
// @try {
|
||||
// id provider = [self valueForKey:keyPath];
|
||||
// if (!provider && self) {
|
||||
// [self setValue:self forKey:keyPath];
|
||||
// }else{
|
||||
// [self setValue:nil forKey:keyPath];
|
||||
// }
|
||||
// } @catch (NSException *exception) {
|
||||
// } @finally {}
|
||||
// }
|
||||
}
|
||||
@end
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// NSLayoutConstraint+BSIBDesignable.h
|
||||
// SealTalk
|
||||
//
|
||||
// Created by LOSER on 2019/11/28.
|
||||
// Copyright © 2019 RongCloud. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
// 基准屏幕宽度
|
||||
#define kRefereWidth 375.0
|
||||
// 以屏幕宽度为固定比例关系,来计算对应的值。假设:基准屏幕宽度375,floatV=10;当前屏幕宽度为750时,那么返回的值为20
|
||||
#define AdaptW(floatValue) (floatValue*[[UIScreen mainScreen] bounds].size.width/kRefereWidth)
|
||||
|
||||
@interface NSLayoutConstraint (BSIBDesignable)
|
||||
@property(nonatomic, assign) IBInspectable BOOL adapterScreen;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -0,0 +1,34 @@
|
||||
//
|
||||
// NSLayoutConstraint+BSIBDesignable.m
|
||||
// SealTalk
|
||||
//
|
||||
// Created by LOSER on 2019/11/28.
|
||||
// Copyright © 2019 RongCloud. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSLayoutConstraint+BSIBDesignable.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation NSLayoutConstraint (BSIBDesignable)
|
||||
|
||||
//定义常量 必须是C语言字符串
|
||||
static char *AdapterScreenKey = "AdapterScreenKey";
|
||||
|
||||
- (BOOL)adapterScreen{
|
||||
NSNumber *number = objc_getAssociatedObject(self, AdapterScreenKey);
|
||||
return number.boolValue;
|
||||
}
|
||||
|
||||
- (void)setAdapterScreen:(BOOL)adapterScreen {
|
||||
|
||||
NSNumber *number = @(adapterScreen);
|
||||
objc_setAssociatedObject(self, AdapterScreenKey, number, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
if (adapterScreen){
|
||||
self.constant = AdaptW(self.constant);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
16
HiBit/Utils/Category/UIView/UIView+Extension.h
Normal file
16
HiBit/Utils/Category/UIView/UIView+Extension.h
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// UIView+Extension.h
|
||||
// QinJiuTV
|
||||
//
|
||||
// Created by HI_LOSER on 2024/5/16.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIView (Extension)
|
||||
- (void)addTapGestureRecognizerWithTarget:(nullable id)target action:(SEL)action;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
16
HiBit/Utils/Category/UIView/UIView+Extension.m
Normal file
16
HiBit/Utils/Category/UIView/UIView+Extension.m
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// UIView+Extension.m
|
||||
// QinJiuTV
|
||||
//
|
||||
// Created by HI_LOSER on 2024/5/16.
|
||||
//
|
||||
|
||||
#import "UIView+Extension.h"
|
||||
|
||||
@implementation UIView (Extension)
|
||||
- (void)addTapGestureRecognizerWithTarget:(nullable id)target action:(SEL)action {
|
||||
self.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:target action:action];
|
||||
[self addGestureRecognizer:tapGestureRecognizer];
|
||||
}
|
||||
@end
|
59
HiBit/Utils/Category/UIView/UIView+Frame.h
Normal file
59
HiBit/Utils/Category/UIView/UIView+Frame.h
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// UIView+Frame.h
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/2/21.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIView (Frame)
|
||||
- (void)setX:(CGFloat)x;
|
||||
- (CGFloat)x;
|
||||
|
||||
- (void)setY:(CGFloat)y;
|
||||
- (CGFloat)y;
|
||||
|
||||
- (void)setWidth:(CGFloat)width;
|
||||
- (CGFloat)width;
|
||||
|
||||
- (void)setHeight:(CGFloat)height;
|
||||
- (CGFloat)height;
|
||||
|
||||
- (CGFloat)bottom;
|
||||
|
||||
- (void)setCenterX:(CGFloat)centerX;
|
||||
- (CGFloat)centerX;
|
||||
|
||||
- (void)setCenterY:(CGFloat)centerY;
|
||||
- (CGFloat)centerY;
|
||||
|
||||
- (void)setSize:(CGSize)size;
|
||||
- (CGSize)size;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface UIView (Layer)
|
||||
- (void)acs_radiusWithRadius:(CGFloat)radius corner:(UIRectCorner)corner;
|
||||
@end
|
||||
|
||||
|
||||
@interface UIView (Animation)
|
||||
|
||||
/// 开始旋转动画
|
||||
- (void)startRotatAnimation;
|
||||
|
||||
/// 停止旋转动画
|
||||
- (void)stopRotatAnimation;
|
||||
|
||||
/// 开始抖动动画
|
||||
- (void)startShakeAnimation;
|
||||
|
||||
/// 停止抖动动画
|
||||
- (void)stopShakeAnimation;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
131
HiBit/Utils/Category/UIView/UIView+Frame.m
Normal file
131
HiBit/Utils/Category/UIView/UIView+Frame.m
Normal file
@ -0,0 +1,131 @@
|
||||
//
|
||||
// UIView+Frame.m
|
||||
// Hyto
|
||||
//
|
||||
// Created by LOSER on 2020/2/21.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIView+Frame.h"
|
||||
@implementation UIView (Frame)
|
||||
- (void)setX:(CGFloat)x{
|
||||
CGRect frame = self.frame;
|
||||
frame.origin.x = x;
|
||||
self.frame = frame;
|
||||
}
|
||||
- (CGFloat)x{
|
||||
return self.frame.origin.x;
|
||||
}
|
||||
|
||||
- (void)setY:(CGFloat)y{
|
||||
CGRect frame = self.frame;
|
||||
frame.origin.y = y;
|
||||
self.frame = frame;
|
||||
}
|
||||
- (CGFloat)y{
|
||||
return self.frame.origin.y;
|
||||
}
|
||||
|
||||
- (void)setWidth:(CGFloat)width{
|
||||
CGRect frame = self.frame;
|
||||
frame.size.width = width;
|
||||
self.frame = frame;
|
||||
}
|
||||
- (CGFloat)width{
|
||||
return self.frame.size.width;
|
||||
}
|
||||
|
||||
- (void)setHeight:(CGFloat)height{
|
||||
CGRect frame = self.frame;
|
||||
frame.size.height = height;
|
||||
self.frame = frame;
|
||||
}
|
||||
- (CGFloat)height{
|
||||
return self.frame.size.height;
|
||||
}
|
||||
- (CGFloat)bottom{
|
||||
return CGRectGetMaxY(self.frame);
|
||||
}
|
||||
- (void)setCenterX:(CGFloat)centerX{
|
||||
CGPoint center = self.center;
|
||||
center.x = centerX;
|
||||
self.center = center;
|
||||
}
|
||||
- (CGFloat)centerX{
|
||||
return self.center.x;
|
||||
}
|
||||
|
||||
- (void)setCenterY:(CGFloat)centerY{
|
||||
CGPoint center = self.center;
|
||||
center.y = centerY;
|
||||
self.center = center;
|
||||
}
|
||||
|
||||
- (CGFloat)centerY{
|
||||
return self.center.y;
|
||||
}
|
||||
|
||||
- (void)setSize:(CGSize)size{
|
||||
CGRect frame = self.frame;
|
||||
frame.size = size;
|
||||
self.frame = frame;
|
||||
}
|
||||
|
||||
- (CGSize)size{
|
||||
return self.frame.size;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation UIView (Layer)
|
||||
- (void)acs_radiusWithRadius:(CGFloat)radius corner:(UIRectCorner)corner {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
self.layer.cornerRadius = radius;
|
||||
self.layer.maskedCorners = (CACornerMask)corner;
|
||||
} else {
|
||||
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corner cornerRadii:CGSizeMake(radius, radius)];
|
||||
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
||||
maskLayer.frame = self.bounds;
|
||||
maskLayer.path = path.CGPath;
|
||||
self.layer.mask = maskLayer;
|
||||
}
|
||||
if ([self isKindOfClass:[UIImageView class]] || [self isKindOfClass:[UIButton class]]){
|
||||
self.layer.masksToBounds = YES;
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation UIView (Animation)
|
||||
static NSString *rotatKey = @"rotat";
|
||||
static NSString *shakeKey = @"shake";
|
||||
- (void)startRotatAnimation{
|
||||
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
//默认是顺时针效果,若将fromValue和toValue的值互换,则为逆时针效果
|
||||
animation.fromValue = [NSNumber numberWithFloat:0.f];
|
||||
animation.toValue = [NSNumber numberWithFloat: M_PI *2];
|
||||
animation.duration = 1;
|
||||
animation.autoreverses = NO;
|
||||
animation.fillMode = kCAFillModeForwards;
|
||||
animation.repeatCount = MAXFLOAT; //如果这里想设置成一直自旋转,可以设置为MAXFLOAT,否则设置具体的数值则代表执行多少次
|
||||
[self.layer addAnimation:animation forKey:rotatKey];
|
||||
|
||||
|
||||
}
|
||||
- (void)stopRotatAnimation{
|
||||
[self.layer removeAnimationForKey:rotatKey];
|
||||
|
||||
}
|
||||
|
||||
- (void)startShakeAnimation{
|
||||
CAKeyframeAnimation *shake=[CAKeyframeAnimation animationWithKeyPath:@"position.x"];
|
||||
shake.values = @[@0,@-10,@10,@-10,@0];
|
||||
shake.additive = YES;
|
||||
shake.duration = 0.25;
|
||||
[self.layer addAnimation:shake forKey:shakeKey];
|
||||
}
|
||||
- (void)stopShakeAnimation{
|
||||
[self.layer removeAnimationForKey:shakeKey];
|
||||
|
||||
}
|
||||
@end
|
@ -0,0 +1,22 @@
|
||||
//
|
||||
// UINavigationController+Transparent.h
|
||||
// LVTravel
|
||||
//
|
||||
// Created by LOSER on 2020/5/26.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UINavigationController (Transparent)
|
||||
@end
|
||||
|
||||
@interface UIViewController (Transparent)
|
||||
@property (strong, nonatomic) UIColor * navBarTintColor;
|
||||
@property (assign, nonatomic) CGFloat navBarBgAlpha;
|
||||
@property (strong, nonatomic) UIColor * navBarBackColor;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -0,0 +1,201 @@
|
||||
//
|
||||
// UINavigationController+Transparent.m
|
||||
// LVTravel
|
||||
//
|
||||
// Created by LOSER on 2020/5/26.
|
||||
// Copyright © 2020 htyo. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UINavigationController+Transparent.h"
|
||||
#import "NSObject+Swizzled.h"
|
||||
@implementation UINavigationController (Transparent)
|
||||
|
||||
//+ (void)load{
|
||||
//
|
||||
// static dispatch_once_t onceToken;
|
||||
// dispatch_once(&onceToken, ^{
|
||||
// NSArray * needSwizzleSelectorArr = @[@"_updateInteractiveTransition:",
|
||||
// NSStringFromSelector(@selector(popViewControllerAnimated:)),
|
||||
// NSStringFromSelector(@selector(popToViewController:animated:)),
|
||||
// NSStringFromSelector(@selector(popToRootViewControllerAnimated:))];
|
||||
//
|
||||
// for (NSString * original in needSwizzleSelectorArr) {
|
||||
// NSString * swizzled = [[@"htyo_" stringByAppendingString:original]stringByReplacingOccurrencesOfString:@"__" withString:@"_"];
|
||||
// SEL originalMethod = NSSelectorFromString(original);
|
||||
// SEL swizzledMethod = NSSelectorFromString(swizzled);
|
||||
// swizzling_exchangeMethod([self class], originalMethod, swizzledMethod);
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
- (void)htyo_updateInteractiveTransition:(CGFloat)percentComplete{
|
||||
|
||||
UIViewController * topViewController = self.topViewController;
|
||||
id <UIViewControllerTransitionCoordinator> coordinator = topViewController.transitionCoordinator;
|
||||
|
||||
if (!topViewController || !coordinator) {
|
||||
[self htyo_updateInteractiveTransition:percentComplete];
|
||||
return;
|
||||
}
|
||||
|
||||
[coordinator notifyWhenInteractionChangesUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
||||
[self dealInteractionChanges:context];
|
||||
}];
|
||||
|
||||
UIViewController * fromViewController = [coordinator viewControllerForKey:UITransitionContextFromViewControllerKey];
|
||||
UIViewController * toViewController = [coordinator viewControllerForKey:UITransitionContextToViewControllerKey];
|
||||
CGFloat fromAlpha = fromViewController.navBarBgAlpha;
|
||||
CGFloat toAlpha = toViewController.navBarBgAlpha;
|
||||
CGFloat newAlpha = fromAlpha + (toAlpha - fromAlpha) * percentComplete;
|
||||
|
||||
[self setNeedsNavigationBackground:newAlpha];
|
||||
|
||||
UIColor * fromColor = fromViewController.navBarTintColor;
|
||||
UIColor * toColor = toViewController.navBarTintColor;
|
||||
UIColor * newColor = [self averageColorFromColor:fromColor toColor:toColor percent:percentComplete];
|
||||
self.navigationBar.tintColor = newColor;
|
||||
[self htyo_updateInteractiveTransition:percentComplete];
|
||||
|
||||
}
|
||||
- (UIViewController *)htyo_popViewControllerAnimated:(BOOL)animated{
|
||||
|
||||
[self setNeedsNavigationBackground:self.viewControllers[self.viewControllers.count -2].navBarBgAlpha];
|
||||
self.navigationBar.tintColor = self.viewControllers[self.viewControllers.count -2].navBarTintColor;
|
||||
return [self htyo_popViewControllerAnimated:animated];
|
||||
}
|
||||
- (UIViewController *)htyo_popToViewController:(UIViewController *) viewController animated:(BOOL)animated{
|
||||
[self setNeedsNavigationBackground:viewController.navBarBgAlpha];
|
||||
self.navigationBar.tintColor = viewController.navBarTintColor;
|
||||
return [self htyo_popToViewController:viewController animated:animated];
|
||||
}
|
||||
- (UIViewController *)htyo_popToRootViewControllerAnimated:(BOOL)animated{
|
||||
|
||||
if (@available(iOS 13.0, *)) {
|
||||
if (self.viewControllers.count > 1 && self.interactivePopGestureRecognizer.state != UIGestureRecognizerStateBegan) {
|
||||
UIViewController * popToViewController = self.viewControllers[self.viewControllers.count - 2];
|
||||
[self setNeedsNavigationBackground:popToViewController.navBarBgAlpha];
|
||||
self.navigationBar.tintColor = popToViewController.navBarTintColor;
|
||||
}
|
||||
}
|
||||
return [self htyo_popToRootViewControllerAnimated:animated];
|
||||
}
|
||||
|
||||
- (void)dealInteractionChanges:(id<UIViewControllerTransitionCoordinatorContext>)context{
|
||||
if (context.isCancelled) {
|
||||
NSTimeInterval cancelDuration = context.transitionDuration * (double)(context.percentComplete);
|
||||
[UIView animateWithDuration:cancelDuration animations:^{
|
||||
[self animations:UITransitionContextFromViewControllerKey context:context];
|
||||
}];
|
||||
}else{
|
||||
NSTimeInterval finishDuration = context.transitionDuration * (double)(1 - context.percentComplete);
|
||||
[UIView animateWithDuration:finishDuration animations:^{
|
||||
[self animations:UITransitionContextToViewControllerKey context:context];
|
||||
}];
|
||||
}
|
||||
}
|
||||
- (void)animations:(UITransitionContextViewControllerKey)key context:(id<UIViewControllerTransitionCoordinatorContext>)context{
|
||||
CGFloat newAlpha = [context viewControllerForKey:key].navBarBgAlpha?:0;
|
||||
[self setNeedsNavigationBackground:newAlpha];
|
||||
self.navigationBar.tintColor = [context viewControllerForKey:key].navBarTintColor;
|
||||
}
|
||||
- (void)setNeedsNavigationBackground:(CGFloat)alpha{
|
||||
UIView * barBackgroundView = self.navigationBar.subviews.firstObject;
|
||||
|
||||
if (@available(iOS 13.0, *)) {
|
||||
barBackgroundView.alpha = alpha;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
UIView * shaddowView = [barBackgroundView valueForKey:@"_shadowView"];
|
||||
if ([shaddowView isKindOfClass:[UIImageView class]]) {
|
||||
shaddowView.alpha = alpha;
|
||||
shaddowView.hidden = alpha==0;
|
||||
}
|
||||
if (self.navigationBar.isTranslucent) {
|
||||
if (@available(iOS 10.0, *)) {
|
||||
UIView * backgroundEffectView = [barBackgroundView valueForKey:@"_backgroundEffectView"];
|
||||
UIImage * image = [self.navigationBar backgroundImageForBarMetrics:UIBarMetricsDefault];
|
||||
|
||||
if ([backgroundEffectView isKindOfClass:[UIView class]] && image == nil) {
|
||||
backgroundEffectView.alpha = alpha;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
UIView * adaptiveBackdrop = [barBackgroundView valueForKey:@"_adaptiveBackdrop"];
|
||||
|
||||
if ([adaptiveBackdrop isKindOfClass:[UIView class]]) {
|
||||
UIView * backdropEffectView = [adaptiveBackdrop valueForKey:@"_backdropEffectView"];
|
||||
if ([backdropEffectView.class isKindOfClass:[UIView class]]) {
|
||||
backdropEffectView.alpha = alpha;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
barBackgroundView.alpha = alpha;
|
||||
}
|
||||
- (UIColor *)averageColorFromColor:(UIColor *) fromColor toColor:(UIColor *) toColor percent:(CGFloat) percentComplete{
|
||||
|
||||
CGFloat fromRed = 0;
|
||||
CGFloat fromGreen = 0;
|
||||
CGFloat fromBlue = 0;
|
||||
CGFloat fromAlpha = 0;
|
||||
|
||||
[fromColor getRed:&fromRed green:&fromGreen blue:&fromBlue alpha:&fromAlpha];
|
||||
|
||||
CGFloat toRed = 0;
|
||||
CGFloat toGreen = 0;
|
||||
CGFloat toBlue = 0;
|
||||
CGFloat toAlpha = 0;
|
||||
|
||||
[toColor getRed:&toRed green:&toGreen blue:&toBlue alpha:&toAlpha];
|
||||
|
||||
CGFloat newRed = fromRed + (toRed - fromRed) * percentComplete;
|
||||
CGFloat newGreen = fromGreen + (toGreen - fromGreen) * percentComplete;
|
||||
CGFloat newBlue = fromBlue + (toBlue - fromBlue) * percentComplete;
|
||||
CGFloat newAlpha = fromAlpha + (toAlpha - fromAlpha) * percentComplete;
|
||||
|
||||
return [UIColor colorWithRed:newRed green:newGreen blue:newBlue alpha:newAlpha];
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation UIViewController (Transparent)
|
||||
static char navBarTintColorKey;
|
||||
static char navBarBackColorKey;
|
||||
|
||||
static char navBarBgAlphaKey;
|
||||
|
||||
-(void)setNavBarTintColor:(UIColor *)navBarTintColor{
|
||||
self.navigationController.navigationBar.tintColor = navBarTintColor;
|
||||
objc_setAssociatedObject(self, &navBarTintColorKey, navBarTintColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
|
||||
}
|
||||
- (UIColor *)navBarTintColor{
|
||||
return objc_getAssociatedObject(self, &navBarTintColorKey);
|
||||
}
|
||||
-(void)setNavBarBackColor:(UIColor *)navBarBackColor{
|
||||
objc_setAssociatedObject(self, &navBarBackColorKey, navBarBackColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
|
||||
}
|
||||
-(UIColor *)navBarBackColor{
|
||||
return objc_getAssociatedObject(self, &navBarBackColorKey);
|
||||
|
||||
}
|
||||
|
||||
- (void)setNavBarBgAlpha:(CGFloat)navBarBgAlpha{
|
||||
CGFloat alpha = MAX(MIN(navBarBgAlpha, 1), 0); // 必须在 0~1的范围
|
||||
|
||||
objc_setAssociatedObject(self, &navBarBgAlphaKey, @(alpha), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
[self.navigationController setNeedsNavigationBackground:alpha];
|
||||
}
|
||||
-(CGFloat)navBarBgAlpha{
|
||||
NSNumber * value = objc_getAssociatedObject(self, &navBarBgAlphaKey);
|
||||
if (!value) {
|
||||
return 1.0;
|
||||
}else{
|
||||
return value.floatValue;
|
||||
}
|
||||
|
||||
}
|
||||
@end
|
@ -0,0 +1,16 @@
|
||||
//
|
||||
// UIViewController+present.h
|
||||
// KKRP
|
||||
//
|
||||
// Created by LOSER on 2020/1/4.
|
||||
// Copyright © 2020 RongCloud. All rights reserved.
|
||||
//
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIViewController (present)
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -0,0 +1,31 @@
|
||||
//
|
||||
// UIViewController+present.m
|
||||
// KKRP
|
||||
//
|
||||
// Created by LOSER on 2020/1/4.
|
||||
// Copyright © 2020 RongCloud. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIViewController+present.h"
|
||||
#import "NSObject+Swizzled.h"
|
||||
|
||||
|
||||
@implementation UIViewController (present)
|
||||
+ (void)load {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
swizzling_exchangeMethod([self class],
|
||||
@selector(presentViewController:animated:completion:),
|
||||
@selector(myPresentViewController:animated:completion:));
|
||||
});
|
||||
}
|
||||
|
||||
- (void)myPresentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion {
|
||||
//设置满屏,不需要小卡片
|
||||
if(@available(iOS 13.0, *)) {
|
||||
viewControllerToPresent.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
}
|
||||
[self myPresentViewController:viewControllerToPresent animated:flag completion:completion];
|
||||
}
|
||||
|
||||
@end
|
183
HiBit/Utils/GTM+AES/GTMBase64.h
Executable file
183
HiBit/Utils/GTM+AES/GTMBase64.h
Executable file
@ -0,0 +1,183 @@
|
||||
//
|
||||
// GTMBase64.h
|
||||
//
|
||||
// Copyright 2006-2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
// use this file except in compliance with the License. You may obtain a copy
|
||||
// of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations under
|
||||
// the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "GTMDefines.h"
|
||||
|
||||
// GTMBase64
|
||||
//
|
||||
/// Helper for handling Base64 and WebSafeBase64 encodings
|
||||
//
|
||||
/// The webSafe methods use different character set and also the results aren't
|
||||
/// always padded to a multiple of 4 characters. This is done so the resulting
|
||||
/// data can be used in urls and url query arguments without needing any
|
||||
/// encoding. You must use the webSafe* methods together, the data does not
|
||||
/// interop with the RFC methods.
|
||||
//
|
||||
@interface GTMBase64 : NSObject
|
||||
|
||||
//
|
||||
// Standard Base64 (RFC) handling
|
||||
//
|
||||
|
||||
// encodeData:
|
||||
//
|
||||
/// Base64 encodes contents of the NSData object.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)encodeData:(NSData *)data;
|
||||
|
||||
// decodeData:
|
||||
//
|
||||
/// Base64 decodes contents of the NSData object.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the decoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)decodeData:(NSData *)data;
|
||||
|
||||
// encodeBytes:length:
|
||||
//
|
||||
/// Base64 encodes the data pointed at by |bytes|.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)encodeBytes:(const void *)bytes length:(NSUInteger)length;
|
||||
|
||||
// decodeBytes:length:
|
||||
//
|
||||
/// Base64 decodes the data pointed at by |bytes|.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)decodeBytes:(const void *)bytes length:(NSUInteger)length;
|
||||
|
||||
// stringByEncodingData:
|
||||
//
|
||||
/// Base64 encodes contents of the NSData object.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSString with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSString *)stringByEncodingData:(NSData *)data;
|
||||
|
||||
// stringByEncodingBytes:length:
|
||||
//
|
||||
/// Base64 encodes the data pointed at by |bytes|.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSString with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSString *)stringByEncodingBytes:(const void *)bytes length:(NSUInteger)length;
|
||||
|
||||
// decodeString:
|
||||
//
|
||||
/// Base64 decodes contents of the NSString.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the decoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)decodeString:(NSString *)string;
|
||||
|
||||
//
|
||||
// Modified Base64 encoding so the results can go onto urls.
|
||||
//
|
||||
// The changes are in the characters generated and also allows the result to
|
||||
// not be padded to a multiple of 4.
|
||||
// Must use the matching call to encode/decode, won't interop with the
|
||||
// RFC versions.
|
||||
//
|
||||
|
||||
// webSafeEncodeData:padded:
|
||||
//
|
||||
/// WebSafe Base64 encodes contents of the NSData object. If |padded| is YES
|
||||
/// then padding characters are added so the result length is a multiple of 4.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)webSafeEncodeData:(NSData *)data
|
||||
padded:(BOOL)padded;
|
||||
|
||||
// webSafeDecodeData:
|
||||
//
|
||||
/// WebSafe Base64 decodes contents of the NSData object.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the decoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)webSafeDecodeData:(NSData *)data;
|
||||
|
||||
// webSafeEncodeBytes:length:padded:
|
||||
//
|
||||
/// WebSafe Base64 encodes the data pointed at by |bytes|. If |padded| is YES
|
||||
/// then padding characters are added so the result length is a multiple of 4.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)webSafeEncodeBytes:(const void *)bytes
|
||||
length:(NSUInteger)length
|
||||
padded:(BOOL)padded;
|
||||
|
||||
// webSafeDecodeBytes:length:
|
||||
//
|
||||
/// WebSafe Base64 decodes the data pointed at by |bytes|.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)webSafeDecodeBytes:(const void *)bytes length:(NSUInteger)length;
|
||||
|
||||
// stringByWebSafeEncodingData:padded:
|
||||
//
|
||||
/// WebSafe Base64 encodes contents of the NSData object. If |padded| is YES
|
||||
/// then padding characters are added so the result length is a multiple of 4.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSString with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSString *)stringByWebSafeEncodingData:(NSData *)data
|
||||
padded:(BOOL)padded;
|
||||
|
||||
// stringByWebSafeEncodingBytes:length:padded:
|
||||
//
|
||||
/// WebSafe Base64 encodes the data pointed at by |bytes|. If |padded| is YES
|
||||
/// then padding characters are added so the result length is a multiple of 4.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSString with the encoded payload. nil for any error.
|
||||
//
|
||||
+(NSString *)stringByWebSafeEncodingBytes:(const void *)bytes
|
||||
length:(NSUInteger)length
|
||||
padded:(BOOL)padded;
|
||||
|
||||
// webSafeDecodeString:
|
||||
//
|
||||
/// WebSafe Base64 decodes contents of the NSString.
|
||||
//
|
||||
/// Returns:
|
||||
/// A new autoreleased NSData with the decoded payload. nil for any error.
|
||||
//
|
||||
+(NSData *)webSafeDecodeString:(NSString *)string;
|
||||
|
||||
@end
|
699
HiBit/Utils/GTM+AES/GTMBase64.m
Executable file
699
HiBit/Utils/GTM+AES/GTMBase64.m
Executable file
@ -0,0 +1,699 @@
|
||||
//
|
||||
// GTMBase64.m
|
||||
//
|
||||
// Copyright 2006-2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
// use this file except in compliance with the License. You may obtain a copy
|
||||
// of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations under
|
||||
// the License.
|
||||
//
|
||||
|
||||
#import "GTMBase64.h"
|
||||
#import "GTMDefines.h"
|
||||
|
||||
static const char *kBase64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static const char *kWebSafeBase64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
static const char kBase64PaddingChar = '=';
|
||||
static const char kBase64InvalidChar = 99;
|
||||
|
||||
static const char kBase64DecodeChars[] = {
|
||||
// This array was generated by the following code:
|
||||
// #include <sys/time.h>
|
||||
// #include <stdlib.h>
|
||||
// #include <string.h>
|
||||
// main()
|
||||
// {
|
||||
// static const char Base64[] =
|
||||
// "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
// char *pos;
|
||||
// int idx, i, j;
|
||||
// printf(" ");
|
||||
// for (i = 0; i < 255; i += 8) {
|
||||
// for (j = i; j < i + 8; j++) {
|
||||
// pos = strchr(Base64, j);
|
||||
// if ((pos == NULL) || (j == 0))
|
||||
// idx = 99;
|
||||
// else
|
||||
// idx = pos - Base64;
|
||||
// if (idx == 99)
|
||||
// printf(" %2d, ", idx);
|
||||
// else
|
||||
// printf(" %2d/*%c*/,", idx, j);
|
||||
// }
|
||||
// printf("\n ");
|
||||
// }
|
||||
// }
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 62/*+*/, 99, 99, 99, 63/*/ */,
|
||||
52/*0*/, 53/*1*/, 54/*2*/, 55/*3*/, 56/*4*/, 57/*5*/, 58/*6*/, 59/*7*/,
|
||||
60/*8*/, 61/*9*/, 99, 99, 99, 99, 99, 99,
|
||||
99, 0/*A*/, 1/*B*/, 2/*C*/, 3/*D*/, 4/*E*/, 5/*F*/, 6/*G*/,
|
||||
7/*H*/, 8/*I*/, 9/*J*/, 10/*K*/, 11/*L*/, 12/*M*/, 13/*N*/, 14/*O*/,
|
||||
15/*P*/, 16/*Q*/, 17/*R*/, 18/*S*/, 19/*T*/, 20/*U*/, 21/*V*/, 22/*W*/,
|
||||
23/*X*/, 24/*Y*/, 25/*Z*/, 99, 99, 99, 99, 99,
|
||||
99, 26/*a*/, 27/*b*/, 28/*c*/, 29/*d*/, 30/*e*/, 31/*f*/, 32/*g*/,
|
||||
33/*h*/, 34/*i*/, 35/*j*/, 36/*k*/, 37/*l*/, 38/*m*/, 39/*n*/, 40/*o*/,
|
||||
41/*p*/, 42/*q*/, 43/*r*/, 44/*s*/, 45/*t*/, 46/*u*/, 47/*v*/, 48/*w*/,
|
||||
49/*x*/, 50/*y*/, 51/*z*/, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99
|
||||
};
|
||||
|
||||
static const char kWebSafeBase64DecodeChars[] = {
|
||||
// This array was generated by the following code:
|
||||
// #include <sys/time.h>
|
||||
// #include <stdlib.h>
|
||||
// #include <string.h>
|
||||
// main()
|
||||
// {
|
||||
// static const char Base64[] =
|
||||
// "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
// char *pos;
|
||||
// int idx, i, j;
|
||||
// printf(" ");
|
||||
// for (i = 0; i < 255; i += 8) {
|
||||
// for (j = i; j < i + 8; j++) {
|
||||
// pos = strchr(Base64, j);
|
||||
// if ((pos == NULL) || (j == 0))
|
||||
// idx = 99;
|
||||
// else
|
||||
// idx = pos - Base64;
|
||||
// if (idx == 99)
|
||||
// printf(" %2d, ", idx);
|
||||
// else
|
||||
// printf(" %2d/*%c*/,", idx, j);
|
||||
// }
|
||||
// printf("\n ");
|
||||
// }
|
||||
// }
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 62/*-*/, 99, 99,
|
||||
52/*0*/, 53/*1*/, 54/*2*/, 55/*3*/, 56/*4*/, 57/*5*/, 58/*6*/, 59/*7*/,
|
||||
60/*8*/, 61/*9*/, 99, 99, 99, 99, 99, 99,
|
||||
99, 0/*A*/, 1/*B*/, 2/*C*/, 3/*D*/, 4/*E*/, 5/*F*/, 6/*G*/,
|
||||
7/*H*/, 8/*I*/, 9/*J*/, 10/*K*/, 11/*L*/, 12/*M*/, 13/*N*/, 14/*O*/,
|
||||
15/*P*/, 16/*Q*/, 17/*R*/, 18/*S*/, 19/*T*/, 20/*U*/, 21/*V*/, 22/*W*/,
|
||||
23/*X*/, 24/*Y*/, 25/*Z*/, 99, 99, 99, 99, 63/*_*/,
|
||||
99, 26/*a*/, 27/*b*/, 28/*c*/, 29/*d*/, 30/*e*/, 31/*f*/, 32/*g*/,
|
||||
33/*h*/, 34/*i*/, 35/*j*/, 36/*k*/, 37/*l*/, 38/*m*/, 39/*n*/, 40/*o*/,
|
||||
41/*p*/, 42/*q*/, 43/*r*/, 44/*s*/, 45/*t*/, 46/*u*/, 47/*v*/, 48/*w*/,
|
||||
49/*x*/, 50/*y*/, 51/*z*/, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99,
|
||||
99, 99, 99, 99, 99, 99, 99, 99
|
||||
};
|
||||
|
||||
|
||||
// Tests a character to see if it's a whitespace character.
|
||||
//
|
||||
// Returns:
|
||||
// YES if the character is a whitespace character.
|
||||
// NO if the character is not a whitespace character.
|
||||
//
|
||||
GTM_INLINE BOOL IsSpace(unsigned char c) {
|
||||
// we use our own mapping here because we don't want anything w/ locale
|
||||
// support.
|
||||
static BOOL kSpaces[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // 0-9
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 10-19
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20-29
|
||||
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, // 30-39
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40-49
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50-59
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60-69
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 70-79
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80-89
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 90-99
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 100-109
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 110-119
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 120-129
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 130-139
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 140-149
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 150-159
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 160-169
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 170-179
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 180-189
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 190-199
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 200-209
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 210-219
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 220-229
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 230-239
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 240-249
|
||||
0, 0, 0, 0, 0, 1, // 250-255
|
||||
};
|
||||
return kSpaces[c];
|
||||
}
|
||||
|
||||
// Calculate how long the data will be once it's base64 encoded.
|
||||
//
|
||||
// Returns:
|
||||
// The guessed encoded length for a source length
|
||||
//
|
||||
GTM_INLINE NSUInteger CalcEncodedLength(NSUInteger srcLen, BOOL padded) {
|
||||
NSUInteger intermediate_result = 8 * srcLen + 5;
|
||||
NSUInteger len = intermediate_result / 6;
|
||||
if (padded) {
|
||||
len = ((len + 3) / 4) * 4;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
// Tries to calculate how long the data will be once it's base64 decoded.
|
||||
// Unlike the above, this is always an upperbound, since the source data
|
||||
// could have spaces and might end with the padding characters on them.
|
||||
//
|
||||
// Returns:
|
||||
// The guessed decoded length for a source length
|
||||
//
|
||||
GTM_INLINE NSUInteger GuessDecodedLength(NSUInteger srcLen) {
|
||||
return (srcLen + 3) / 4 * 3;
|
||||
}
|
||||
|
||||
|
||||
@interface GTMBase64 (PrivateMethods)
|
||||
|
||||
+(NSData *)baseEncode:(const void *)bytes
|
||||
length:(NSUInteger)length
|
||||
charset:(const char *)charset
|
||||
padded:(BOOL)padded;
|
||||
|
||||
+(NSData *)baseDecode:(const void *)bytes
|
||||
length:(NSUInteger)length
|
||||
charset:(const char*)charset
|
||||
requirePadding:(BOOL)requirePadding;
|
||||
|
||||
+(NSUInteger)baseEncode:(const char *)srcBytes
|
||||
srcLen:(NSUInteger)srcLen
|
||||
destBytes:(char *)destBytes
|
||||
destLen:(NSUInteger)destLen
|
||||
charset:(const char *)charset
|
||||
padded:(BOOL)padded;
|
||||
|
||||
+(NSUInteger)baseDecode:(const char *)srcBytes
|
||||
srcLen:(NSUInteger)srcLen
|
||||
destBytes:(char *)destBytes
|
||||
destLen:(NSUInteger)destLen
|
||||
charset:(const char *)charset
|
||||
requirePadding:(BOOL)requirePadding;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation GTMBase64
|
||||
|
||||
//
|
||||
// Standard Base64 (RFC) handling
|
||||
//
|
||||
|
||||
+(NSData *)encodeData:(NSData *)data {
|
||||
return [self baseEncode:[data bytes]
|
||||
length:[data length]
|
||||
charset:kBase64EncodeChars
|
||||
padded:YES];
|
||||
}
|
||||
|
||||
+(NSData *)decodeData:(NSData *)data {
|
||||
return [self baseDecode:[data bytes]
|
||||
length:[data length]
|
||||
charset:kBase64DecodeChars
|
||||
requirePadding:YES];
|
||||
}
|
||||
|
||||
+(NSData *)encodeBytes:(const void *)bytes length:(NSUInteger)length {
|
||||
return [self baseEncode:bytes
|
||||
length:length
|
||||
charset:kBase64EncodeChars
|
||||
padded:YES];
|
||||
}
|
||||
|
||||
+(NSData *)decodeBytes:(const void *)bytes length:(NSUInteger)length {
|
||||
return [self baseDecode:bytes
|
||||
length:length
|
||||
charset:kBase64DecodeChars
|
||||
requirePadding:YES];
|
||||
}
|
||||
|
||||
+(NSString *)stringByEncodingData:(NSData *)data {
|
||||
NSString *result = nil;
|
||||
NSData *converted = [self baseEncode:[data bytes]
|
||||
length:[data length]
|
||||
charset:kBase64EncodeChars
|
||||
padded:YES];
|
||||
if (converted) {
|
||||
result = [[NSString alloc] initWithData:converted
|
||||
encoding:NSASCIIStringEncoding] ;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+(NSString *)stringByEncodingBytes:(const void *)bytes length:(NSUInteger)length {
|
||||
NSString *result = nil;
|
||||
NSData *converted = [self baseEncode:bytes
|
||||
length:length
|
||||
charset:kBase64EncodeChars
|
||||
padded:YES];
|
||||
if (converted) {
|
||||
result = [[NSString alloc] initWithData:converted
|
||||
encoding:NSASCIIStringEncoding] ;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+(NSData *)decodeString:(NSString *)string {
|
||||
NSData *result = nil;
|
||||
NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding];
|
||||
if (data) {
|
||||
result = [self baseDecode:[data bytes]
|
||||
length:[data length]
|
||||
charset:kBase64DecodeChars
|
||||
requirePadding:YES];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Modified Base64 encoding so the results can go onto urls.
|
||||
//
|
||||
// The changes are in the characters generated and also the result isn't
|
||||
// padded to a multiple of 4.
|
||||
// Must use the matching call to encode/decode, won't interop with the
|
||||
// RFC versions.
|
||||
//
|
||||
|
||||
+(NSData *)webSafeEncodeData:(NSData *)data
|
||||
padded:(BOOL)padded {
|
||||
return [self baseEncode:[data bytes]
|
||||
length:[data length]
|
||||
charset:kWebSafeBase64EncodeChars
|
||||
padded:padded];
|
||||
}
|
||||
|
||||
+(NSData *)webSafeDecodeData:(NSData *)data {
|
||||
return [self baseDecode:[data bytes]
|
||||
length:[data length]
|
||||
charset:kWebSafeBase64DecodeChars
|
||||
requirePadding:NO];
|
||||
}
|
||||
|
||||
+(NSData *)webSafeEncodeBytes:(const void *)bytes
|
||||
length:(NSUInteger)length
|
||||
padded:(BOOL)padded {
|
||||
return [self baseEncode:bytes
|
||||
length:length
|
||||
charset:kWebSafeBase64EncodeChars
|
||||
padded:padded];
|
||||
}
|
||||
|
||||
+(NSData *)webSafeDecodeBytes:(const void *)bytes length:(NSUInteger)length {
|
||||
return [self baseDecode:bytes
|
||||
length:length
|
||||
charset:kWebSafeBase64DecodeChars
|
||||
requirePadding:NO];
|
||||
}
|
||||
|
||||
+(NSString *)stringByWebSafeEncodingData:(NSData *)data
|
||||
padded:(BOOL)padded {
|
||||
NSString *result = nil;
|
||||
NSData *converted = [self baseEncode:[data bytes]
|
||||
length:[data length]
|
||||
charset:kWebSafeBase64EncodeChars
|
||||
padded:padded];
|
||||
if (converted) {
|
||||
result = [[NSString alloc] initWithData:converted
|
||||
encoding:NSASCIIStringEncoding];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+(NSString *)stringByWebSafeEncodingBytes:(const void *)bytes
|
||||
length:(NSUInteger)length
|
||||
padded:(BOOL)padded {
|
||||
NSString *result = nil;
|
||||
NSData *converted = [self baseEncode:bytes
|
||||
length:length
|
||||
charset:kWebSafeBase64EncodeChars
|
||||
padded:padded];
|
||||
if (converted) {
|
||||
result = [[NSString alloc] initWithData:converted
|
||||
encoding:NSASCIIStringEncoding] ;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+(NSData *)webSafeDecodeString:(NSString *)string {
|
||||
NSData *result = nil;
|
||||
NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding];
|
||||
if (data) {
|
||||
result = [self baseDecode:[data bytes]
|
||||
length:[data length]
|
||||
charset:kWebSafeBase64DecodeChars
|
||||
requirePadding:NO];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GTMBase64 (PrivateMethods)
|
||||
|
||||
//
|
||||
// baseEncode:length:charset:padded:
|
||||
//
|
||||
// Does the common lifting of creating the dest NSData. it creates & sizes the
|
||||
// data for the results. |charset| is the characters to use for the encoding
|
||||
// of the data. |padding| controls if the encoded data should be padded to a
|
||||
// multiple of 4.
|
||||
//
|
||||
// Returns:
|
||||
// an autorelease NSData with the encoded data, nil if any error.
|
||||
//
|
||||
+(NSData *)baseEncode:(const void *)bytes
|
||||
length:(NSUInteger)length
|
||||
charset:(const char *)charset
|
||||
padded:(BOOL)padded {
|
||||
// how big could it be?
|
||||
NSUInteger maxLength = CalcEncodedLength(length, padded);
|
||||
// make space
|
||||
NSMutableData *result = [NSMutableData data];
|
||||
[result setLength:maxLength];
|
||||
// do it
|
||||
NSUInteger finalLength = [self baseEncode:bytes
|
||||
srcLen:length
|
||||
destBytes:[result mutableBytes]
|
||||
destLen:[result length]
|
||||
charset:charset
|
||||
padded:padded];
|
||||
if (finalLength) {
|
||||
_GTMDevAssert(finalLength == maxLength, @"how did we calc the length wrong?");
|
||||
} else {
|
||||
// shouldn't happen, this means we ran out of space
|
||||
result = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// baseDecode:length:charset:requirePadding:
|
||||
//
|
||||
// Does the common lifting of creating the dest NSData. it creates & sizes the
|
||||
// data for the results. |charset| is the characters to use for the decoding
|
||||
// of the data.
|
||||
//
|
||||
// Returns:
|
||||
// an autorelease NSData with the decoded data, nil if any error.
|
||||
//
|
||||
//
|
||||
+(NSData *)baseDecode:(const void *)bytes
|
||||
length:(NSUInteger)length
|
||||
charset:(const char *)charset
|
||||
requirePadding:(BOOL)requirePadding {
|
||||
// could try to calculate what it will end up as
|
||||
NSUInteger maxLength = GuessDecodedLength(length);
|
||||
// make space
|
||||
NSMutableData *result = [NSMutableData data];
|
||||
[result setLength:maxLength];
|
||||
// do it
|
||||
NSUInteger finalLength = [self baseDecode:bytes
|
||||
srcLen:length
|
||||
destBytes:[result mutableBytes]
|
||||
destLen:[result length]
|
||||
charset:charset
|
||||
requirePadding:requirePadding];
|
||||
if (finalLength) {
|
||||
if (finalLength != maxLength) {
|
||||
// resize down to how big it was
|
||||
[result setLength:finalLength];
|
||||
}
|
||||
} else {
|
||||
// either an error in the args, or we ran out of space
|
||||
result = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// baseEncode:srcLen:destBytes:destLen:charset:padded:
|
||||
//
|
||||
// Encodes the buffer into the larger. returns the length of the encoded
|
||||
// data, or zero for an error.
|
||||
// |charset| is the characters to use for the encoding
|
||||
// |padded| tells if the result should be padded to a multiple of 4.
|
||||
//
|
||||
// Returns:
|
||||
// the length of the encoded data. zero if any error.
|
||||
//
|
||||
+(NSUInteger)baseEncode:(const char *)srcBytes
|
||||
srcLen:(NSUInteger)srcLen
|
||||
destBytes:(char *)destBytes
|
||||
destLen:(NSUInteger)destLen
|
||||
charset:(const char *)charset
|
||||
padded:(BOOL)padded {
|
||||
if (!srcLen || !destLen || !srcBytes || !destBytes) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *curDest = destBytes;
|
||||
const unsigned char *curSrc = (const unsigned char *)(srcBytes);
|
||||
|
||||
// Three bytes of data encodes to four characters of cyphertext.
|
||||
// So we can pump through three-byte chunks atomically.
|
||||
while (srcLen > 2) {
|
||||
// space?
|
||||
_GTMDevAssert(destLen >= 4, @"our calc for encoded length was wrong");
|
||||
curDest[0] = charset[curSrc[0] >> 2];
|
||||
curDest[1] = charset[((curSrc[0] & 0x03) << 4) + (curSrc[1] >> 4)];
|
||||
curDest[2] = charset[((curSrc[1] & 0x0f) << 2) + (curSrc[2] >> 6)];
|
||||
curDest[3] = charset[curSrc[2] & 0x3f];
|
||||
|
||||
curDest += 4;
|
||||
curSrc += 3;
|
||||
srcLen -= 3;
|
||||
destLen -= 4;
|
||||
}
|
||||
|
||||
// now deal with the tail (<=2 bytes)
|
||||
switch (srcLen) {
|
||||
case 0:
|
||||
// Nothing left; nothing more to do.
|
||||
break;
|
||||
case 1:
|
||||
// One byte left: this encodes to two characters, and (optionally)
|
||||
// two pad characters to round out the four-character cypherblock.
|
||||
_GTMDevAssert(destLen >= 2, @"our calc for encoded length was wrong");
|
||||
curDest[0] = charset[curSrc[0] >> 2];
|
||||
curDest[1] = charset[(curSrc[0] & 0x03) << 4];
|
||||
curDest += 2;
|
||||
destLen -= 2;
|
||||
if (padded) {
|
||||
_GTMDevAssert(destLen >= 2, @"our calc for encoded length was wrong");
|
||||
curDest[0] = kBase64PaddingChar;
|
||||
curDest[1] = kBase64PaddingChar;
|
||||
curDest += 2;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// Two bytes left: this encodes to three characters, and (optionally)
|
||||
// one pad character to round out the four-character cypherblock.
|
||||
_GTMDevAssert(destLen >= 3, @"our calc for encoded length was wrong");
|
||||
curDest[0] = charset[curSrc[0] >> 2];
|
||||
curDest[1] = charset[((curSrc[0] & 0x03) << 4) + (curSrc[1] >> 4)];
|
||||
curDest[2] = charset[(curSrc[1] & 0x0f) << 2];
|
||||
curDest += 3;
|
||||
destLen -= 3;
|
||||
if (padded) {
|
||||
_GTMDevAssert(destLen >= 1, @"our calc for encoded length was wrong");
|
||||
curDest[0] = kBase64PaddingChar;
|
||||
curDest += 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// return the length
|
||||
return (curDest - destBytes);
|
||||
}
|
||||
|
||||
//
|
||||
// baseDecode:srcLen:destBytes:destLen:charset:requirePadding:
|
||||
//
|
||||
// Decodes the buffer into the larger. returns the length of the decoded
|
||||
// data, or zero for an error.
|
||||
// |charset| is the character decoding buffer to use
|
||||
//
|
||||
// Returns:
|
||||
// the length of the encoded data. zero if any error.
|
||||
//
|
||||
+(NSUInteger)baseDecode:(const char *)srcBytes
|
||||
srcLen:(NSUInteger)srcLen
|
||||
destBytes:(char *)destBytes
|
||||
destLen:(NSUInteger)destLen
|
||||
charset:(const char *)charset
|
||||
requirePadding:(BOOL)requirePadding {
|
||||
if (!srcLen || !destLen || !srcBytes || !destBytes) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int decode;
|
||||
NSUInteger destIndex = 0;
|
||||
int state = 0;
|
||||
char ch = 0;
|
||||
while (srcLen-- && (ch = *srcBytes++) != 0) {
|
||||
|
||||
if (IsSpace(ch)) // Skip whitespace
|
||||
continue;
|
||||
|
||||
if (ch == kBase64PaddingChar) break;
|
||||
if (ch == '\xe6') break;
|
||||
if (ch == '\xe5') break;
|
||||
if (ch == '\xe8') break;
|
||||
if (ch == '\xe7') break;
|
||||
if (ch == '\xe4') break;
|
||||
|
||||
decode = charset[(unsigned int)ch];
|
||||
if (decode == kBase64InvalidChar)
|
||||
return 0;
|
||||
|
||||
// Four cyphertext characters decode to three bytes.
|
||||
// Therefore we can be in one of four states.
|
||||
switch (state) {
|
||||
case 0:
|
||||
// We're at the beginning of a four-character cyphertext block.
|
||||
// This sets the high six bits of the first byte of the
|
||||
// plaintext block.
|
||||
_GTMDevAssert(destIndex < destLen, @"our calc for decoded length was wrong");
|
||||
destBytes[destIndex] = decode << 2;
|
||||
state = 1;
|
||||
break;
|
||||
case 1:
|
||||
// We're one character into a four-character cyphertext block.
|
||||
// This sets the low two bits of the first plaintext byte,
|
||||
// and the high four bits of the second plaintext byte.
|
||||
_GTMDevAssert((destIndex+1) < destLen, @"our calc for decoded length was wrong");
|
||||
destBytes[destIndex] |= decode >> 4;
|
||||
destBytes[destIndex+1] = (decode & 0x0f) << 4;
|
||||
destIndex++;
|
||||
state = 2;
|
||||
break;
|
||||
case 2:
|
||||
// We're two characters into a four-character cyphertext block.
|
||||
// This sets the low four bits of the second plaintext
|
||||
// byte, and the high two bits of the third plaintext byte.
|
||||
// However, if this is the end of data, and those two
|
||||
// bits are zero, it could be that those two bits are
|
||||
// leftovers from the encoding of data that had a length
|
||||
// of two mod three.
|
||||
_GTMDevAssert((destIndex+1) < destLen, @"our calc for decoded length was wrong");
|
||||
destBytes[destIndex] |= decode >> 2;
|
||||
destBytes[destIndex+1] = (decode & 0x03) << 6;
|
||||
destIndex++;
|
||||
state = 3;
|
||||
break;
|
||||
case 3:
|
||||
// We're at the last character of a four-character cyphertext block.
|
||||
// This sets the low six bits of the third plaintext byte.
|
||||
_GTMDevAssert(destIndex < destLen, @"our calc for decoded length was wrong");
|
||||
destBytes[destIndex] |= decode;
|
||||
destIndex++;
|
||||
state = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We are done decoding Base-64 chars. Let's see if we ended
|
||||
// on a byte boundary, and/or with erroneous trailing characters.
|
||||
if (ch == kBase64PaddingChar) { // We got a pad char
|
||||
if ((state == 0) || (state == 1)) {
|
||||
return 0; // Invalid '=' in first or second position
|
||||
}
|
||||
if (srcLen == 0) {
|
||||
if (state == 2) { // We run out of input but we still need another '='
|
||||
return 0;
|
||||
}
|
||||
// Otherwise, we are in state 3 and only need this '='
|
||||
} else {
|
||||
if (state == 2) { // need another '='
|
||||
while ((ch = *srcBytes++) && (srcLen-- > 0)) {
|
||||
if (!IsSpace(ch))
|
||||
break;
|
||||
}
|
||||
if (ch != kBase64PaddingChar) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// state = 1 or 2, check if all remain padding is space
|
||||
while ((ch = *srcBytes++) && (srcLen-- > 0)) {
|
||||
if (!IsSpace(ch)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We ended by seeing the end of the string.
|
||||
|
||||
if (requirePadding) {
|
||||
// If we require padding, then anything but state 0 is an error.
|
||||
if (state != 0) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// Make sure we have no partial bytes lying around. Note that we do not
|
||||
// require trailing '=', so states 2 and 3 are okay too.
|
||||
if (state == 1) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If then next piece of output was valid and got written to it means we got a
|
||||
// very carefully crafted input that appeared valid but contains some trailing
|
||||
// bits past the real length, so just toss the thing.
|
||||
if ((destIndex < destLen) &&
|
||||
(destBytes[destIndex] != 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return destIndex;
|
||||
}
|
||||
|
||||
@end
|
421
HiBit/Utils/GTM+AES/GTMDefines.h
Executable file
421
HiBit/Utils/GTM+AES/GTMDefines.h
Executable file
@ -0,0 +1,421 @@
|
||||
//
|
||||
// GTMDefines.h
|
||||
//
|
||||
// Copyright 2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
// use this file except in compliance with the License. You may obtain a copy
|
||||
// of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations under
|
||||
// the License.
|
||||
//
|
||||
|
||||
// ============================================================================
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#include <Availability.h>
|
||||
#endif // TARGET_OS_IPHONE
|
||||
|
||||
// Not all MAC_OS_X_VERSION_10_X macros defined in past SDKs
|
||||
#ifndef MAC_OS_X_VERSION_10_5
|
||||
#define MAC_OS_X_VERSION_10_5 1050
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_6
|
||||
#define MAC_OS_X_VERSION_10_6 1060
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_7
|
||||
#define MAC_OS_X_VERSION_10_7 1070
|
||||
#endif
|
||||
|
||||
// Not all __IPHONE_X macros defined in past SDKs
|
||||
#ifndef __IPHONE_3_0
|
||||
#define __IPHONE_3_0 30000
|
||||
#endif
|
||||
#ifndef __IPHONE_3_1
|
||||
#define __IPHONE_3_1 30100
|
||||
#endif
|
||||
#ifndef __IPHONE_3_2
|
||||
#define __IPHONE_3_2 30200
|
||||
#endif
|
||||
#ifndef __IPHONE_4_0
|
||||
#define __IPHONE_4_0 40000
|
||||
#endif
|
||||
#ifndef __IPHONE_4_3
|
||||
#define __IPHONE_4_3 40300
|
||||
#endif
|
||||
#ifndef __IPHONE_5_0
|
||||
#define __IPHONE_5_0 50000
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CPP symbols that can be overridden in a prefix to control how the toolbox
|
||||
// is compiled.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// By setting the GTM_CONTAINERS_VALIDATION_FAILED_LOG and
|
||||
// GTM_CONTAINERS_VALIDATION_FAILED_ASSERT macros you can control what happens
|
||||
// when a validation fails. If you implement your own validators, you may want
|
||||
// to control their internals using the same macros for consistency.
|
||||
#ifndef GTM_CONTAINERS_VALIDATION_FAILED_ASSERT
|
||||
#define GTM_CONTAINERS_VALIDATION_FAILED_ASSERT 0
|
||||
#endif
|
||||
|
||||
// Give ourselves a consistent way to do inlines. Apple's macros even use
|
||||
// a few different actual definitions, so we're based off of the foundation
|
||||
// one.
|
||||
#if !defined(GTM_INLINE)
|
||||
#if (defined (__GNUC__) && (__GNUC__ == 4)) || defined (__clang__)
|
||||
#define GTM_INLINE static __inline__ __attribute__((always_inline))
|
||||
#else
|
||||
#define GTM_INLINE static __inline__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Give ourselves a consistent way of doing externs that links up nicely
|
||||
// when mixing objc and objc++
|
||||
#if !defined (GTM_EXTERN)
|
||||
#if defined __cplusplus
|
||||
#define GTM_EXTERN extern "C"
|
||||
#define GTM_EXTERN_C_BEGIN extern "C" {
|
||||
#define GTM_EXTERN_C_END }
|
||||
#else
|
||||
#define GTM_EXTERN extern
|
||||
#define GTM_EXTERN_C_BEGIN
|
||||
#define GTM_EXTERN_C_END
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Give ourselves a consistent way of exporting things if we have visibility
|
||||
// set to hidden.
|
||||
#if !defined (GTM_EXPORT)
|
||||
#define GTM_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
// Give ourselves a consistent way of declaring something as unused. This
|
||||
// doesn't use __unused because that is only supported in gcc 4.2 and greater.
|
||||
#if !defined (GTM_UNUSED)
|
||||
#define GTM_UNUSED(x) ((void)(x))
|
||||
#endif
|
||||
|
||||
// _GTMDevLog & _GTMDevAssert
|
||||
//
|
||||
// _GTMDevLog & _GTMDevAssert are meant to be a very lightweight shell for
|
||||
// developer level errors. This implementation simply macros to NSLog/NSAssert.
|
||||
// It is not intended to be a general logging/reporting system.
|
||||
//
|
||||
// Please see http://code.google.com/p/google-toolbox-for-mac/wiki/DevLogNAssert
|
||||
// for a little more background on the usage of these macros.
|
||||
//
|
||||
// _GTMDevLog log some error/problem in debug builds
|
||||
// _GTMDevAssert assert if conditon isn't met w/in a method/function
|
||||
// in all builds.
|
||||
//
|
||||
// To replace this system, just provide different macro definitions in your
|
||||
// prefix header. Remember, any implementation you provide *must* be thread
|
||||
// safe since this could be called by anything in what ever situtation it has
|
||||
// been placed in.
|
||||
//
|
||||
|
||||
// We only define the simple macros if nothing else has defined this.
|
||||
#ifndef _GTMDevLog
|
||||
|
||||
#ifdef DEBUG
|
||||
#define _GTMDevLog(...) NSLog(__VA_ARGS__)
|
||||
#else
|
||||
#define _GTMDevLog(...) do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif // _GTMDevLog
|
||||
|
||||
#ifndef _GTMDevAssert
|
||||
// we directly invoke the NSAssert handler so we can pass on the varargs
|
||||
// (NSAssert doesn't have a macro we can use that takes varargs)
|
||||
#if !defined(NS_BLOCK_ASSERTIONS)
|
||||
#define _GTMDevAssert(condition, ...) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
[[NSAssertionHandler currentHandler] \
|
||||
handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \
|
||||
file:[NSString stringWithUTF8String:__FILE__] \
|
||||
lineNumber:__LINE__ \
|
||||
description:__VA_ARGS__]; \
|
||||
} \
|
||||
} while(0)
|
||||
#else // !defined(NS_BLOCK_ASSERTIONS)
|
||||
#define _GTMDevAssert(condition, ...) do { } while (0)
|
||||
#endif // !defined(NS_BLOCK_ASSERTIONS)
|
||||
|
||||
#endif // _GTMDevAssert
|
||||
|
||||
// _GTMCompileAssert
|
||||
// _GTMCompileAssert is an assert that is meant to fire at compile time if you
|
||||
// want to check things at compile instead of runtime. For example if you
|
||||
// want to check that a wchar is 4 bytes instead of 2 you would use
|
||||
// _GTMCompileAssert(sizeof(wchar_t) == 4, wchar_t_is_4_bytes_on_OS_X)
|
||||
// Note that the second "arg" is not in quotes, and must be a valid processor
|
||||
// symbol in it's own right (no spaces, punctuation etc).
|
||||
|
||||
// Wrapping this in an #ifndef allows external groups to define their own
|
||||
// compile time assert scheme.
|
||||
#ifndef _GTMCompileAssert
|
||||
// We got this technique from here:
|
||||
// http://unixjunkie.blogspot.com/2007/10/better-compile-time-asserts_29.html
|
||||
|
||||
#define _GTMCompileAssertSymbolInner(line, msg) _GTMCOMPILEASSERT ## line ## __ ## msg
|
||||
#define _GTMCompileAssertSymbol(line, msg) _GTMCompileAssertSymbolInner(line, msg)
|
||||
#define _GTMCompileAssert(test, msg) \
|
||||
typedef char _GTMCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ]
|
||||
#endif // _GTMCompileAssert
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CPP symbols defined based on the project settings so the GTM code has
|
||||
// simple things to test against w/o scattering the knowledge of project
|
||||
// setting through all the code.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Provide a single constant CPP symbol that all of GTM uses for ifdefing
|
||||
// iPhone code.
|
||||
#if TARGET_OS_IPHONE // iPhone SDK
|
||||
// For iPhone specific stuff
|
||||
#define GTM_IPHONE_SDK 1
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
#define GTM_IPHONE_SIMULATOR 1
|
||||
#else
|
||||
#define GTM_IPHONE_DEVICE 1
|
||||
#endif // TARGET_IPHONE_SIMULATOR
|
||||
// By default, GTM has provided it's own unittesting support, define this
|
||||
// to use the support provided by Xcode, especially for the Xcode4 support
|
||||
// for unittesting.
|
||||
#ifndef GTM_IPHONE_USE_SENTEST
|
||||
#define GTM_IPHONE_USE_SENTEST 0
|
||||
#endif
|
||||
#else
|
||||
// For MacOS specific stuff
|
||||
#define GTM_MACOS_SDK 1
|
||||
#endif
|
||||
|
||||
// Some of our own availability macros
|
||||
#if GTM_MACOS_SDK
|
||||
#define GTM_AVAILABLE_ONLY_ON_IPHONE UNAVAILABLE_ATTRIBUTE
|
||||
#define GTM_AVAILABLE_ONLY_ON_MACOS
|
||||
#else
|
||||
#define GTM_AVAILABLE_ONLY_ON_IPHONE
|
||||
#define GTM_AVAILABLE_ONLY_ON_MACOS UNAVAILABLE_ATTRIBUTE
|
||||
#endif
|
||||
|
||||
// Provide a symbol to include/exclude extra code for GC support. (This mainly
|
||||
// just controls the inclusion of finalize methods).
|
||||
#ifndef GTM_SUPPORT_GC
|
||||
#if GTM_IPHONE_SDK
|
||||
// iPhone never needs GC
|
||||
#define GTM_SUPPORT_GC 0
|
||||
#else
|
||||
// We can't find a symbol to tell if GC is supported/required, so best we
|
||||
// do on Mac targets is include it if we're on 10.5 or later.
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||
#define GTM_SUPPORT_GC 0
|
||||
#else
|
||||
#define GTM_SUPPORT_GC 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// To simplify support for 64bit (and Leopard in general), we provide the type
|
||||
// defines for non Leopard SDKs
|
||||
#if !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
// NSInteger/NSUInteger and Max/Mins
|
||||
#ifndef NSINTEGER_DEFINED
|
||||
#if __LP64__ || NS_BUILD_32_LIKE_64
|
||||
typedef long NSInteger;
|
||||
typedef unsigned long NSUInteger;
|
||||
#else
|
||||
typedef int NSInteger;
|
||||
typedef unsigned int NSUInteger;
|
||||
#endif
|
||||
#define NSIntegerMax LONG_MAX
|
||||
#define NSIntegerMin LONG_MIN
|
||||
#define NSUIntegerMax ULONG_MAX
|
||||
#define NSINTEGER_DEFINED 1
|
||||
#endif // NSINTEGER_DEFINED
|
||||
// CGFloat
|
||||
#ifndef CGFLOAT_DEFINED
|
||||
#if defined(__LP64__) && __LP64__
|
||||
// This really is an untested path (64bit on Tiger?)
|
||||
typedef double CGFloat;
|
||||
#define CGFLOAT_MIN DBL_MIN
|
||||
#define CGFLOAT_MAX DBL_MAX
|
||||
#define CGFLOAT_IS_DOUBLE 1
|
||||
#else /* !defined(__LP64__) || !__LP64__ */
|
||||
typedef float CGFloat;
|
||||
#define CGFLOAT_MIN FLT_MIN
|
||||
#define CGFLOAT_MAX FLT_MAX
|
||||
#define CGFLOAT_IS_DOUBLE 0
|
||||
#endif /* !defined(__LP64__) || !__LP64__ */
|
||||
#define CGFLOAT_DEFINED 1
|
||||
#endif // CGFLOAT_DEFINED
|
||||
#endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||
|
||||
// Some support for advanced clang static analysis functionality
|
||||
// See http://clang-analyzer.llvm.org/annotations.html
|
||||
#ifndef __has_feature // Optional.
|
||||
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
|
||||
#endif
|
||||
|
||||
#ifndef NS_RETURNS_RETAINED
|
||||
#if __has_feature(attribute_ns_returns_retained)
|
||||
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
|
||||
#else
|
||||
#define NS_RETURNS_RETAINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NS_RETURNS_NOT_RETAINED
|
||||
#if __has_feature(attribute_ns_returns_not_retained)
|
||||
#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
|
||||
#else
|
||||
#define NS_RETURNS_NOT_RETAINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CF_RETURNS_RETAINED
|
||||
#if __has_feature(attribute_cf_returns_retained)
|
||||
#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
|
||||
#else
|
||||
#define CF_RETURNS_RETAINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CF_RETURNS_NOT_RETAINED
|
||||
#if __has_feature(attribute_cf_returns_not_retained)
|
||||
#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained))
|
||||
#else
|
||||
#define CF_RETURNS_NOT_RETAINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NS_CONSUMED
|
||||
#if __has_feature(attribute_ns_consumed)
|
||||
#define NS_CONSUMED __attribute__((ns_consumed))
|
||||
#else
|
||||
#define NS_CONSUMED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CF_CONSUMED
|
||||
#if __has_feature(attribute_cf_consumed)
|
||||
#define CF_CONSUMED __attribute__((cf_consumed))
|
||||
#else
|
||||
#define CF_CONSUMED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NS_CONSUMES_SELF
|
||||
#if __has_feature(attribute_ns_consumes_self)
|
||||
#define NS_CONSUMES_SELF __attribute__((ns_consumes_self))
|
||||
#else
|
||||
#define NS_CONSUMES_SELF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Defined on 10.6 and above.
|
||||
#ifndef NS_FORMAT_ARGUMENT
|
||||
#define NS_FORMAT_ARGUMENT(A)
|
||||
#endif
|
||||
|
||||
// Defined on 10.6 and above.
|
||||
#ifndef NS_FORMAT_FUNCTION
|
||||
#define NS_FORMAT_FUNCTION(F,A)
|
||||
#endif
|
||||
|
||||
// Defined on 10.6 and above.
|
||||
#ifndef CF_FORMAT_ARGUMENT
|
||||
#define CF_FORMAT_ARGUMENT(A)
|
||||
#endif
|
||||
|
||||
// Defined on 10.6 and above.
|
||||
#ifndef CF_FORMAT_FUNCTION
|
||||
#define CF_FORMAT_FUNCTION(F,A)
|
||||
#endif
|
||||
|
||||
#ifndef GTM_NONNULL
|
||||
#define GTM_NONNULL(x) __attribute__((nonnull(x)))
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
// Declared here so that it can easily be used for logging tracking if
|
||||
// necessary. See GTMUnitTestDevLog.h for details.
|
||||
@class NSString;
|
||||
GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...);
|
||||
|
||||
// Macro to allow you to create NSStrings out of other macros.
|
||||
// #define FOO foo
|
||||
// NSString *fooString = GTM_NSSTRINGIFY(FOO);
|
||||
#if !defined (GTM_NSSTRINGIFY)
|
||||
#define GTM_NSSTRINGIFY_INNER(x) @#x
|
||||
#define GTM_NSSTRINGIFY(x) GTM_NSSTRINGIFY_INNER(x)
|
||||
#endif
|
||||
|
||||
// Macro to allow fast enumeration when building for 10.5 or later, and
|
||||
// reliance on NSEnumerator for 10.4. Remember, NSDictionary w/ FastEnumeration
|
||||
// does keys, so pick the right thing, nothing is done on the FastEnumeration
|
||||
// side to be sure you're getting what you wanted.
|
||||
#ifndef GTM_FOREACH_OBJECT
|
||||
#if TARGET_OS_IPHONE || !(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
|
||||
#define GTM_FOREACH_ENUMEREE(element, enumeration) \
|
||||
for (element in enumeration)
|
||||
#define GTM_FOREACH_OBJECT(element, collection) \
|
||||
for (element in collection)
|
||||
#define GTM_FOREACH_KEY(element, collection) \
|
||||
for (element in collection)
|
||||
#else
|
||||
#define GTM_FOREACH_ENUMEREE(element, enumeration) \
|
||||
for (NSEnumerator *_ ## element ## _enum = enumeration; \
|
||||
(element = [_ ## element ## _enum nextObject]) != nil; )
|
||||
#define GTM_FOREACH_OBJECT(element, collection) \
|
||||
GTM_FOREACH_ENUMEREE(element, [collection objectEnumerator])
|
||||
#define GTM_FOREACH_KEY(element, collection) \
|
||||
GTM_FOREACH_ENUMEREE(element, [collection keyEnumerator])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
|
||||
// To simplify support for both Leopard and Snow Leopard we declare
|
||||
// the Snow Leopard protocols that we need here.
|
||||
#if !defined(GTM_10_6_PROTOCOLS_DEFINED) && !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
|
||||
#define GTM_10_6_PROTOCOLS_DEFINED 1
|
||||
@protocol NSConnectionDelegate
|
||||
@end
|
||||
@protocol NSAnimationDelegate
|
||||
@end
|
||||
@protocol NSImageDelegate
|
||||
@end
|
||||
@protocol NSTabViewDelegate
|
||||
@end
|
||||
#endif // !defined(GTM_10_6_PROTOCOLS_DEFINED) && !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
|
||||
|
||||
// GTM_SEL_STRING is for specifying selector (usually property) names to KVC
|
||||
// or KVO methods.
|
||||
// In debug it will generate warnings for undeclared selectors if
|
||||
// -Wunknown-selector is turned on.
|
||||
// In release it will have no runtime overhead.
|
||||
#ifndef GTM_SEL_STRING
|
||||
#ifdef DEBUG
|
||||
#define GTM_SEL_STRING(selName) NSStringFromSelector(@selector(selName))
|
||||
#else
|
||||
#define GTM_SEL_STRING(selName) @#selName
|
||||
#endif // DEBUG
|
||||
#endif // GTM_SEL_STRING
|
||||
|
||||
#endif // __OBJC__
|
21
HiBit/Utils/GTM+AES/NSString+AES.h
Executable file
21
HiBit/Utils/GTM+AES/NSString+AES.h
Executable file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// NSString+AES.h
|
||||
//
|
||||
//
|
||||
// Created by Bear on 16/11/26.
|
||||
// Copyright © 2016年 Bear. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSString (AES)
|
||||
|
||||
/**< 加密方法 */
|
||||
- (NSString*)aci_encryptWithAES;
|
||||
|
||||
/**< 解密方法 */
|
||||
- (NSString*)aci_decryptWithAES;
|
||||
|
||||
+ (NSString *)MD5String:(NSString *)signStr;
|
||||
|
||||
@end
|
160
HiBit/Utils/GTM+AES/NSString+AES.m
Executable file
160
HiBit/Utils/GTM+AES/NSString+AES.m
Executable file
@ -0,0 +1,160 @@
|
||||
//
|
||||
// NSString+AES.m
|
||||
//
|
||||
//
|
||||
// Created by Bear on 16/11/26.
|
||||
// Copyright © 2016年 Bear . All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSString+AES.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#import <CommonCrypto/CommonCryptor.h>
|
||||
#import "GTMBase64.h"
|
||||
|
||||
static NSString *const PSW_AES_KEY = @"fyth4578bfhj6sl8";
|
||||
static NSString *const AES_IV_PARAMETER = @"vhu578y4jj99ozd5";
|
||||
|
||||
@implementation NSString (AES)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
- (NSString*)aci_encryptWithAES {
|
||||
NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSData *AESData = [self AES128operation:kCCEncrypt
|
||||
data:data
|
||||
key:PSW_AES_KEY
|
||||
iv:AES_IV_PARAMETER];
|
||||
NSString *baseStr_GTM = [self encodeBase64Data:AESData];
|
||||
// NSLog(@"nGTMBase:%@", baseStr_GTM);
|
||||
return baseStr_GTM;
|
||||
|
||||
/* 看情况使用
|
||||
NSString *baseStr = [AESData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
|
||||
NSLog(@"niOSCode:%@", baseStr);
|
||||
return baseStr;
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
- (NSString*)aci_decryptWithAES {
|
||||
|
||||
// NSLog(@"%@",PSW_AES_KEY);
|
||||
// NSLog(@"%@",AES_IV_PARAMETER);
|
||||
|
||||
NSString * string = self;
|
||||
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSData *baseData_GTM = [string decodeBase64Data:data];
|
||||
NSData *AESData_GTM = [string AES128operation:kCCDecrypt
|
||||
data:baseData_GTM
|
||||
key:PSW_AES_KEY
|
||||
iv:AES_IV_PARAMETER];
|
||||
NSString *decStr_GTM = [[NSString alloc] initWithData:AESData_GTM encoding:NSUTF8StringEncoding];
|
||||
// NSLog(@"nGTMBase:%@", decStr_GTM);
|
||||
|
||||
/* 看情况使用
|
||||
NSData *baseData = [[NSData alloc]initWithBase64EncodedString:self options:0];
|
||||
NSData *AESData = [self AES128operation:kCCDecrypt
|
||||
data:baseData
|
||||
key:PSW_AES_KEY
|
||||
iv:AES_IV_PARAMETER];
|
||||
|
||||
NSString *decStr = [[NSString alloc] initWithData:AESData encoding:NSUTF8StringEncoding];
|
||||
NSLog(@"niOSCode:%@", decStr);
|
||||
return decStr;
|
||||
*/
|
||||
|
||||
return decStr_GTM;
|
||||
}
|
||||
|
||||
/**
|
||||
* AES加解密算法
|
||||
*
|
||||
* @param operation kCCEncrypt(加密)kCCDecrypt(解密)
|
||||
* @param data 待操作Data数据
|
||||
* @param key key
|
||||
* @param iv 向量
|
||||
*
|
||||
* @return NSData
|
||||
*/
|
||||
- (NSData *)AES128operation:(CCOperation)operation data:(NSData *)data key:(NSString *)key iv:(NSString *)iv {
|
||||
|
||||
char keyPtr[kCCKeySizeAES128 + 1];
|
||||
bzero(keyPtr, sizeof(keyPtr));
|
||||
[key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding];
|
||||
|
||||
// IV
|
||||
char ivPtr[kCCBlockSizeAES128 + 1];
|
||||
bzero(ivPtr, sizeof(ivPtr));
|
||||
[iv getCString:ivPtr maxLength:sizeof(ivPtr) encoding:NSUTF8StringEncoding];
|
||||
|
||||
size_t bufferSize = [data length] + kCCBlockSizeAES128;
|
||||
void *buffer = malloc(bufferSize);
|
||||
size_t numBytesEncrypted = 0;
|
||||
|
||||
CCCryptorStatus cryptorStatus = CCCrypt(operation, kCCAlgorithmAES128, kCCOptionPKCS7Padding,
|
||||
keyPtr, kCCKeySizeAES128,
|
||||
ivPtr,
|
||||
[data bytes], [data length],
|
||||
buffer, bufferSize,
|
||||
&numBytesEncrypted);
|
||||
|
||||
if(cryptorStatus == kCCSuccess) {
|
||||
return [NSData dataWithBytesNoCopy:buffer length:numBytesEncrypted];
|
||||
} else {
|
||||
NSLog(@"Error");
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**< GTMBase64编码 */
|
||||
- (NSString*)encodeBase64Data:(NSData *)data {
|
||||
data = [GTMBase64 encodeData:data];
|
||||
NSString *base64String = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
||||
return base64String;
|
||||
}
|
||||
|
||||
/**< GTMBase64解码 */
|
||||
- (NSData*)decodeBase64Data:(NSData *)data {
|
||||
data = [GTMBase64 decodeData:data];
|
||||
return data;
|
||||
}
|
||||
|
||||
- (NSString *) md5:(NSString *)str salt:(NSString *)salt{
|
||||
const char *cStr = [str UTF8String];
|
||||
const char *salts = [salt UTF8String];
|
||||
unsigned char result[16];
|
||||
CC_MD5( cStr, (int)strlen(cStr), result );
|
||||
|
||||
int count = (int)sizeof(result)+(int)strlen(salts) + 1;
|
||||
char *mmm = malloc(count);
|
||||
memcpy(mmm, result, 16);
|
||||
memcpy(mmm+16, salts, strlen(salts));
|
||||
CC_MD5(mmm, (int)strlen(mmm), result);
|
||||
return [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
result[0], result[1], result[2], result[3],
|
||||
result[4], result[5], result[6], result[7],
|
||||
result[8], result[9], result[10], result[11],
|
||||
result[12], result[13], result[14], result[15]
|
||||
];
|
||||
}
|
||||
|
||||
+ (NSString *)MD5String:(NSString *)signStr {
|
||||
const char *cstr = [signStr UTF8String];
|
||||
unsigned char result[16];
|
||||
CC_MD5(cstr, (CC_LONG)strlen(cstr), result);
|
||||
return [NSString stringWithFormat:
|
||||
@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
result[0], result[1], result[2], result[3],
|
||||
result[4], result[5], result[6], result[7],
|
||||
result[8], result[9], result[10], result[11],
|
||||
result[12], result[13], result[14], result[15]
|
||||
];
|
||||
}
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
|
||||
@end
|
@ -0,0 +1,19 @@
|
||||
//
|
||||
// DGActivityIndicatorAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 8/10/16.
|
||||
// Copyright © 2016 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
- (CABasicAnimation *)createBasicAnimationWithKeyPath:(NSString *)keyPath;
|
||||
- (CAKeyframeAnimation *)createKeyframeAnimationWithKeyPath:(NSString *)keyPath;
|
||||
- (CAAnimationGroup *)createAnimationGroup;
|
||||
|
||||
@end
|
@ -0,0 +1,35 @@
|
||||
//
|
||||
// DGActivityIndicatorAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 8/10/16.
|
||||
// Copyright © 2016 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorAnimation
|
||||
|
||||
- (CABasicAnimation *)createBasicAnimationWithKeyPath:(NSString *)keyPath {
|
||||
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:keyPath];
|
||||
animation.removedOnCompletion = NO;
|
||||
return animation;
|
||||
}
|
||||
|
||||
- (CAKeyframeAnimation *)createKeyframeAnimationWithKeyPath:(NSString *)keyPath {
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:keyPath];
|
||||
animation.removedOnCompletion = NO;
|
||||
return animation;
|
||||
}
|
||||
|
||||
- (CAAnimationGroup *)createAnimationGroup {
|
||||
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
|
||||
animationGroup.removedOnCompletion = NO;
|
||||
return animationGroup;
|
||||
}
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallBeatAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallBeatAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,57 @@
|
||||
//
|
||||
// DGActivityIndicatorBallBeatAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallBeatAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallBeatAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.7f;
|
||||
NSArray *beginTimes = @[@0.35f, @0.0f, @0.35f];
|
||||
CGFloat circleSpacing = 2.0f;
|
||||
CGFloat circleSize = (size.width - circleSpacing * 2) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - circleSize) / 2;
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[@1.0f, @0.75f, @1.0f];
|
||||
|
||||
// Opacity animation
|
||||
CAKeyframeAnimation *opacityAnimation = [self createKeyframeAnimationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
opacityAnimation.values = @[@1.0f, @0.2f, @1.0f];
|
||||
|
||||
// Aniamtion
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.duration = duration;
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
// Draw circles
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, circleSize, circleSize) cornerRadius:circleSize / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
circle.fillColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake(x + circleSize * i + circleSpacing * i, y, circleSize, circleSize);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotateAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallClipRotateAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,52 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotateAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallClipRotateAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallClipRotateAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.75f;
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.6f, 0.6f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
|
||||
// Rotate animation
|
||||
CAKeyframeAnimation *rotateAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.rotation.z"];
|
||||
|
||||
rotateAnimation.values = @[@0, @M_PI, @(2 * M_PI)];
|
||||
rotateAnimation.keyTimes = scaleAnimation.keyTimes;
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.animations = @[scaleAnimation, rotateAnimation];
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw ball clip
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(size.width / 2, size.height / 2) radius:size.width / 2 startAngle:1.5 * M_PI endAngle:M_PI clockwise:true];
|
||||
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.lineWidth = 2;
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotateMultipleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallClipRotateMultipleAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,90 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotateMultipleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallClipRotateMultipleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallClipRotateMultipleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat bigDuration = 1.0f;
|
||||
CGFloat smallDuration = bigDuration / 2;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
// Big circle
|
||||
{
|
||||
CGFloat circleSize = size.width;
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPath];
|
||||
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-3 * M_PI / 4 endAngle:-M_PI / 4 clockwise:true];
|
||||
[circlePath moveToPoint:CGPointMake(circleSize / 2 - circleSize / 2 * cosf(M_PI / 4), circleSize / 2 + circleSize / 2 * sinf(M_PI / 4))];
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-5 * M_PI / 4 endAngle:-7 * M_PI / 4 clockwise:false];
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.lineWidth = 2;
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation: [self createAnimationInDuration:bigDuration withTimingFunction:timingFunction reverse:false] forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
// Small circle
|
||||
{
|
||||
CGFloat circleSize = size.width / 2;
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPath];
|
||||
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:3 * M_PI / 4 endAngle:5 * M_PI / 4 clockwise:true];
|
||||
[circlePath moveToPoint:CGPointMake(circleSize / 2 + circleSize / 2 * cosf(M_PI / 4), circleSize / 2 - circleSize / 2 * sinf(M_PI / 4))];
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-M_PI / 4 endAngle:M_PI / 4 clockwise:true];
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.lineWidth = 2;
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:[self createAnimationInDuration:smallDuration withTimingFunction:timingFunction reverse:true] forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
- (CAAnimation *)createAnimationInDuration:(CGFloat) duration withTimingFunction:(CAMediaTimingFunction *) timingFunction reverse:(BOOL) reverse {
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.6f, 0.6f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Rotate animation
|
||||
CAKeyframeAnimation *rotateAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.rotation.z"];
|
||||
|
||||
if (!reverse) {
|
||||
rotateAnimation.values = @[@0, @M_PI, @(2 * M_PI)];
|
||||
} else {
|
||||
rotateAnimation.values = @[@0, @-M_PI, @(-2 * M_PI)];
|
||||
}
|
||||
rotateAnimation.keyTimes = scaleAnimation.keyTimes;
|
||||
rotateAnimation.duration = duration;
|
||||
rotateAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.animations = @[scaleAnimation, rotateAnimation];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.duration = duration;
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotatePulseAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallClipRotatePulseAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,85 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotatePulseAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallClipRotatePulseAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallClipRotatePulseAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.09f :0.57f :0.49f :0.9f];
|
||||
|
||||
// Small circle
|
||||
{
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.3f, @1.0f];
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.3f, 0.3f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.repeatCount = HUGE_VALF;
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
CGFloat circleSize = size.width / 2;
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
[circle addAnimation:scaleAnimation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
// Big circle
|
||||
{
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.6f, 0.6f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Rotate animation
|
||||
CAKeyframeAnimation *rotateAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.rotation.z"];
|
||||
|
||||
rotateAnimation.values = @[@0, @M_PI, @(2 * M_PI)];
|
||||
rotateAnimation.keyTimes = scaleAnimation.keyTimes;
|
||||
rotateAnimation.duration = duration;
|
||||
rotateAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.animations = @[scaleAnimation, rotateAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw big circle
|
||||
CGFloat circleSize = size.width;
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPath];
|
||||
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-3 * M_PI / 4 endAngle:-M_PI / 4 clockwise:true];
|
||||
[circlePath moveToPoint:CGPointMake(circleSize / 2 - circleSize / 2 * cosf(M_PI / 4), circleSize / 2 + circleSize / 2 * sinf(M_PI / 4))];
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-5 * M_PI / 4 endAngle:-7 * M_PI / 4 clockwise:false];
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.lineWidth = 2;
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallGridBeatAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallGridBeatAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,55 @@
|
||||
//
|
||||
// DGActivityIndicatorBallGridBeatAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallGridBeatAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallGridBeatAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSArray *durations = @[@0.96f, @0.93f, @1.19f, @1.13f, @1.34f, @0.94f, @1.2f, @0.82f, @1.19f];
|
||||
NSArray *timeOffsets = @[@0.36f, @0.4f, @0.68f, @0.41f, @0.71f, @-0.15f, @-0.12f, @0.01f, @0.32f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
|
||||
CGFloat circleSpacing = 2;
|
||||
CGFloat circleSize = (size.width - circleSpacing * 2) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [self createKeyframeAnimationWithKeyPath:@"opacity"];
|
||||
|
||||
animation.beginTime = CACurrentMediaTime();
|
||||
animation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
animation.values = @[@1.0f, @0.7f, @1.0f];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Draw circle
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
CALayer *circle = [self createCirleWith:circleSize color:tintColor];
|
||||
|
||||
animation.duration = [durations[3 * i + j] floatValue];
|
||||
animation.timeOffset = [timeOffsets[3 * i + j] floatValue];
|
||||
circle.frame = CGRectMake(x + circleSize * j + circleSpacing * j, y + circleSize * i + circleSpacing * i, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (CALayer *)createCirleWith:(CGFloat)size color:(UIColor *)color {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size, size) cornerRadius:size / 2];
|
||||
|
||||
circle.fillColor = color.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
|
||||
return circle;
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallGridPulseAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallGridPulseAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,67 @@
|
||||
//
|
||||
// DGActivityIndicatorBallGridPulseAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallGridPulseAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallGridPulseAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSArray *durations = @[@0.72f, @1.02f, @1.28f, @1.42f, @1.45f, @1.18f, @0.87f, @1.45f, @1.06f];
|
||||
NSArray *timeOffsets = @[@-0.06f, @0.25f, @-0.17f, @0.48f, @0.31f, @0.03f, @0.46f, @0.78f, @0.45f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
|
||||
CGFloat circleSpacing = 2;
|
||||
CGFloat circleSize = (size.width - circleSpacing * 2) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[@1.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *opacityAnimation = [self createKeyframeAnimationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
opacityAnimation.values = @[@1.0f, @0.7f, @1.0f];
|
||||
opacityAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.beginTime = CACurrentMediaTime();
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circle
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
CALayer *circle = [self createCirleWith:circleSize color:tintColor];
|
||||
|
||||
animation.duration = [durations[3 * i + j] floatValue];
|
||||
animation.timeOffset = [timeOffsets[3 * i + j] floatValue];
|
||||
circle.frame = CGRectMake(x + circleSize * j + circleSpacing * j, y + circleSize * i + circleSpacing * i, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (CALayer *)createCirleWith:(CGFloat)size color:(UIColor *)color {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size, size) cornerRadius:size / 2];
|
||||
|
||||
circle.fillColor = color.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
|
||||
return circle;
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallPulseAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallPulseAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,44 @@
|
||||
//
|
||||
// DGActivityIndicatorBallPulseAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallPulseAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallPulseAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat circlePadding = 5.0f;
|
||||
CGFloat circleSize = (size.width - 2 * circlePadding) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - circleSize) / 2;
|
||||
CGFloat duration = 0.75f;
|
||||
NSArray *timeBegins = @[@0.12f, @0.24f, @0.36f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.2f :0.68f :0.18f :1.08f];
|
||||
|
||||
CAKeyframeAnimation *animation = [self createKeyframeAnimationWithKeyPath:@"transform"];
|
||||
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.3f, 0.3f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
animation.keyTimes = @[@0.0f, @0.3f, @1.0f];
|
||||
animation.timingFunctions = @[timingFunction, timingFunction];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.frame = CGRectMake(x + i * circleSize + i * circlePadding, y, circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circle.bounds.size.width / 2;
|
||||
animation.beginTime = [timeBegins[i] floatValue];
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallPulseSyncAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallPulseSyncAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,46 @@
|
||||
//
|
||||
// DGActivityIndicatorBallPulseSyncAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallPulseSyncAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallPulseSyncAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.6f;
|
||||
NSArray *beginTimes = @[@0.07f, @0.14f, @0.21f];
|
||||
CGFloat circleSpacing = 2.0f;
|
||||
CGFloat circleSize = (size.width - circleSpacing * 2) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - circleSize) / 2;
|
||||
CGFloat deltaY = (size.height / 2 - circleSize / 2) / 2;
|
||||
CAMediaTimingFunction *timingFunciton = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [self createKeyframeAnimationWithKeyPath:@"transform.translation.y"];
|
||||
|
||||
animation.duration = duration;
|
||||
animation.keyTimes = @[@0.0f, @0.33f, @0.66f, @1.0f];
|
||||
animation.values = @[@0.0f, @(deltaY), @(-deltaY), @0.0f];
|
||||
animation.timingFunctions = @[timingFunciton, timingFunciton, timingFunciton];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circles
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, circleSize, circleSize) cornerRadius:circleSize / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
circle.fillColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake(x + circleSize * i + circleSpacing * i, y, circleSize, circleSize);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallRotateAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallRotateAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,74 @@
|
||||
//
|
||||
// DGActivityIndicatorBallRotateAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallRotateAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallRotateAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
CGFloat circleSize = size.width / 5;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.7f :-0.13f :0.22f :0.86f];
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.6f, 0.6f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Rotate animation
|
||||
CAKeyframeAnimation *rotateAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.rotation.z"];
|
||||
|
||||
rotateAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
rotateAnimation.values = @[@0, @-M_PI, @(-2 * M_PI)];
|
||||
rotateAnimation.duration = duration;
|
||||
rotateAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.animations = @[scaleAnimation, rotateAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circles
|
||||
CALayer *leftCircle = [CALayer layer];
|
||||
|
||||
leftCircle.backgroundColor = tintColor.CGColor;
|
||||
leftCircle.opacity = 0.8f;
|
||||
leftCircle.cornerRadius = circleSize / 2;
|
||||
leftCircle.frame = CGRectMake(0, (size.height - circleSize) / 2, circleSize, circleSize);
|
||||
|
||||
CALayer *rightCircle = [CALayer layer];
|
||||
|
||||
rightCircle.backgroundColor = tintColor.CGColor;
|
||||
rightCircle.opacity = 0.8f;
|
||||
rightCircle.cornerRadius = circleSize / 2;
|
||||
rightCircle.frame = CGRectMake(size.width - circleSize, (size.height - circleSize) / 2, circleSize, circleSize);
|
||||
|
||||
CALayer *centerCircle = [CALayer layer];
|
||||
|
||||
centerCircle.backgroundColor = tintColor.CGColor;
|
||||
centerCircle.cornerRadius = circleSize / 2;
|
||||
centerCircle.frame = CGRectMake((size.width - circleSize) / 2, (size.height - circleSize) / 2, circleSize, circleSize);
|
||||
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[circle addSublayer:leftCircle];
|
||||
[circle addSublayer:rightCircle];
|
||||
[circle addSublayer:centerCircle];
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallScaleAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,49 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallScaleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallScaleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
|
||||
// Scale animation
|
||||
CABasicAnimation *scaleAnimation = [self createBasicAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.fromValue = @0.0f;
|
||||
scaleAnimation.toValue = @1.0f;
|
||||
|
||||
// Opacity animation
|
||||
CABasicAnimation *opacityAnimation = [self createBasicAnimationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.fromValue = @1.0f;
|
||||
opacityAnimation.toValue = @0.0f;
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.duration = duration;
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circle
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(0, 0, size.width, size.height) cornerRadius:size.width / 2];
|
||||
|
||||
circle.fillColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleMultipleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallScaleMultipleAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,53 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleMultipleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallScaleMultipleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallScaleMultipleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
NSArray *beginTimes = @[@0.0f, @0.2f, @0.4f];
|
||||
|
||||
// Scale animation
|
||||
CABasicAnimation *scaleAnimation = [self createBasicAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.fromValue = @0.0f;
|
||||
scaleAnimation.toValue = @1.0f;
|
||||
|
||||
// Opacity animation
|
||||
CAKeyframeAnimation *opacityAnimation = [self createKeyframeAnimationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.05f, @1.0f];
|
||||
opacityAnimation.values = @[@0.0f, @1.0f, @0.0f];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size.width, size.height) cornerRadius:size.width / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
circle.fillColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.opacity = 0.0f;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleTrippleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallScaleRippleAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,53 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleTrippleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallScaleRippleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallScaleRippleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.21f :0.53f :0.56f :0.8f];
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.7f];
|
||||
scaleAnimation.values = @[@0.1f, @1.0f];
|
||||
scaleAnimation.timingFunction = timingFunction;
|
||||
|
||||
// Opacity animation
|
||||
CAKeyframeAnimation *opacityAnimation = [self createKeyframeAnimationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.7f, @1.0f];
|
||||
opacityAnimation.values = @[@1.0f, @0.7f, @0.0f];
|
||||
opacityAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circle
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size.width, size.height) cornerRadius:size.width / 2];
|
||||
|
||||
circle.fillColor = nil;
|
||||
circle.lineWidth = 2;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleRippleMultipleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallScaleRippleMultipleAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,58 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleRippleMultipleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallScaleRippleMultipleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallScaleRippleMultipleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.25f;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.21f :0.53f :0.56f :0.8f];
|
||||
NSArray *timeOffsets = @[@0.0f, @0.2f, @0.4f];
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.7f];
|
||||
scaleAnimation.values = @[@0.1f, @1.0f];
|
||||
scaleAnimation.timingFunction = timingFunction;
|
||||
|
||||
// Opacity animation
|
||||
CAKeyframeAnimation *opacityAnimation = [self createKeyframeAnimationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.7f, @1.0f];
|
||||
opacityAnimation.values = @[@1.0f, @0.7f, @0.0f];
|
||||
opacityAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [self createAnimationGroup];;
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.beginTime = CACurrentMediaTime();
|
||||
|
||||
// Draw circles
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size.width, size.height) cornerRadius:size.width / 2];
|
||||
|
||||
animation.timeOffset = [timeOffsets[i] floatValue];
|
||||
circle.fillColor = nil;
|
||||
circle.lineWidth = 2;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallSpinFadeLoader.h
|
||||
// CheeseDigest
|
||||
//
|
||||
// Created by Robin.Chao on 9/8/15.
|
||||
// Copyright (c) 2015 mRocker. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallSpinFadeLoader : DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,85 @@
|
||||
//
|
||||
// DGActivityIndicatorBallSpinFadeLoader.m
|
||||
// CheeseDigest
|
||||
//
|
||||
// Created by Robin.Chao on 9/8/15.
|
||||
// Copyright (c) 2015 mRocker. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallSpinFadeLoader.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallSpinFadeLoader
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
|
||||
CGFloat circleSpacing = -2;
|
||||
CGFloat circleSize = (size.width - 4 * circleSpacing) / 5;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
CFTimeInterval duration = 1;
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
NSArray *beginTimes = @[@0, @0.12, @0.24, @0.36, @0.48, @0.6, @0.72, @0.84];
|
||||
|
||||
CAKeyframeAnimation *scaleAnimation = [self createKeyframeAnimationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0, @0.5, @1];
|
||||
scaleAnimation.values = @[@1, @0.4, @1];
|
||||
scaleAnimation.duration = duration;
|
||||
|
||||
|
||||
CAKeyframeAnimation *opacityAnimaton = [self createKeyframeAnimationWithKeyPath:@"opacity"];
|
||||
|
||||
|
||||
opacityAnimaton.keyTimes = @[@0, @0.5, @1];
|
||||
opacityAnimaton.values = @[@1, @0.3, @1];
|
||||
opacityAnimaton.duration = duration;
|
||||
|
||||
|
||||
|
||||
|
||||
CAAnimationGroup *animationGroup = [self createAnimationGroup];;
|
||||
animationGroup.animations = @[scaleAnimation, opacityAnimaton];
|
||||
animationGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animationGroup.duration = duration;
|
||||
animationGroup.repeatCount = HUGE;
|
||||
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
CALayer *circle = [self circleLayer:(M_PI_4 * i) size:circleSize origin:CGPointMake(x, y) containerSize:size color:tintColor];
|
||||
animationGroup.beginTime = beginTime + [beginTimes[i] doubleValue];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:animationGroup forKey:@"animation"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (CALayer *)circleLayer:(CGFloat)angle size:(CGFloat)size origin:(CGPoint)origin containerSize:(CGSize)containerSize color:(UIColor *)color{
|
||||
CGFloat radius = containerSize.width/2;
|
||||
CALayer *circle = [self createLayerWith:CGSizeMake(size, size) color:color];
|
||||
CGRect frame = CGRectMake((origin.x + radius * (cos(angle) + 1) - size / 2), origin.y + radius * (sin(angle) + 1) - size / 2, size, size);
|
||||
circle.frame = frame;
|
||||
|
||||
return circle;
|
||||
}
|
||||
|
||||
- (CALayer *)createLayerWith:(CGSize)size color:(UIColor *)color{
|
||||
CAShapeLayer *layer = [CAShapeLayer layer];
|
||||
UIBezierPath *path = [UIBezierPath bezierPath];
|
||||
|
||||
[path addArcWithCenter:CGPointMake(size.width / 2,size.height / 2) radius:(size.width / 2) startAngle:0 endAngle:2 * M_PI clockwise:NO];
|
||||
layer.fillColor = color.CGColor;
|
||||
layer.backgroundColor = nil;
|
||||
layer.path = path.CGPath;
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallTrianglePathAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallTrianglePathAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,100 @@
|
||||
//
|
||||
// DGActivityIndicatorBallTrianglePathAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallTrianglePathAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallTrianglePathAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 2.0f;
|
||||
CGFloat circleSize = size.width / 5;
|
||||
CGFloat deltaX = size.width / 2 - circleSize / 2;
|
||||
CGFloat deltaY = size.height / 2 - circleSize / 2;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [self createKeyframeAnimationWithKeyPath:@"transform"];
|
||||
|
||||
animation.keyTimes = @[@0.0f, @0.33f, @0.66f, @1.0f];
|
||||
animation.duration = duration;
|
||||
animation.timingFunctions = @[timingFunction, timingFunction, timingFunction];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Top-center circle
|
||||
CALayer *topCenterCircle = [self createCircleWithSize:circleSize color:tintColor];
|
||||
|
||||
[self changeAnimation:animation values:@[@"{0,0}", @"{hx,fy}", @"{-hx,fy}", @"{0,0}"] deltaX:deltaX deltaY:deltaY];
|
||||
topCenterCircle.frame = CGRectMake(x + size.width / 2 - circleSize / 2, y, circleSize, circleSize);
|
||||
[topCenterCircle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:topCenterCircle];
|
||||
|
||||
// Bottom-left circle
|
||||
CALayer *bottomLeftCircle = [self createCircleWithSize:circleSize color:tintColor];
|
||||
|
||||
[self changeAnimation:animation values:@[@"{0,0}", @"{hx,-fy}", @"{fx,0}", @"{0,0}"] deltaX:deltaX deltaY:deltaY];
|
||||
bottomLeftCircle.frame = CGRectMake(x, y + size.height - circleSize, circleSize, circleSize);
|
||||
[bottomLeftCircle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:bottomLeftCircle];
|
||||
|
||||
// Bottom-right circle
|
||||
CALayer *bottomRigthCircle = [self createCircleWithSize:circleSize color:tintColor];
|
||||
|
||||
[self changeAnimation:animation values:@[@"{0,0}", @"{-fx,0}", @"{-hx,-fy}", @"{0,0}"] deltaX:deltaX deltaY:deltaY];
|
||||
bottomRigthCircle.frame = CGRectMake(x + size.width - circleSize, y + size.height - circleSize, circleSize, circleSize);
|
||||
[bottomRigthCircle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:bottomRigthCircle];
|
||||
}
|
||||
|
||||
- (CALayer *)createCircleWithSize:(CGFloat)size color:(UIColor *)color {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size, size) cornerRadius:size / 2];
|
||||
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = color.CGColor;
|
||||
circle.lineWidth = 1;
|
||||
circle.path = circlePath.CGPath;
|
||||
|
||||
return circle;
|
||||
}
|
||||
|
||||
- (CAAnimation *)changeAnimation:(CAKeyframeAnimation *)animation values:(NSArray *)rawValues deltaX:(CGFloat)deltaX deltaY:(CGFloat)deltaY {
|
||||
NSMutableArray *values = [NSMutableArray arrayWithCapacity:5];
|
||||
|
||||
for (NSString *rawValue in rawValues) {
|
||||
CGPoint point = CGPointFromString([self translate:rawValue withDeltaX:deltaX deltaY:deltaY]);
|
||||
|
||||
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(point.x, point.y, 0)]];
|
||||
}
|
||||
animation.values = values;
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
- (NSString *)translate:(NSString *)valueString withDeltaX:(CGFloat)deltaX deltaY:(CGFloat)deltaY {
|
||||
NSMutableString *valueMutableString = [NSMutableString stringWithString:valueString];
|
||||
CGFloat fullDeltaX = 2 * deltaX;
|
||||
CGFloat fullDeltaY = 2 * deltaY;
|
||||
NSRange range;
|
||||
|
||||
range.location = 0;
|
||||
range.length = valueString.length;
|
||||
|
||||
[valueMutableString replaceOccurrencesOfString:@"hx" withString:[NSString stringWithFormat:@"%f", deltaX] options:NSCaseInsensitiveSearch range:range];
|
||||
range.length = valueMutableString.length;
|
||||
[valueMutableString replaceOccurrencesOfString:@"fx" withString:[NSString stringWithFormat:@"%f", fullDeltaX] options:NSCaseInsensitiveSearch range:range];
|
||||
range.length = valueMutableString.length;
|
||||
[valueMutableString replaceOccurrencesOfString:@"hy" withString:[NSString stringWithFormat:@"%f", deltaY] options:NSCaseInsensitiveSearch range:range];
|
||||
range.length = valueMutableString.length;
|
||||
[valueMutableString replaceOccurrencesOfString:@"fy" withString:[NSString stringWithFormat:@"%f", fullDeltaY] options:NSCaseInsensitiveSearch range:range];
|
||||
|
||||
return valueMutableString;
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallZigZagAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallZigZagAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,60 @@
|
||||
//
|
||||
// DGActivityIndicatorBallZigZagAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallZigZagAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallZigZagAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.7f;
|
||||
CGFloat circleSize = size.width / 5;
|
||||
CGFloat deltaX = size.width / 2 - circleSize / 2;
|
||||
CGFloat deltaY = size.height / 2 - circleSize / 2;
|
||||
|
||||
// Circle 1 animation
|
||||
CAKeyframeAnimation *animation = [self createKeyframeAnimationWithKeyPath:@"transform"];
|
||||
|
||||
animation.duration = duration;
|
||||
animation.keyTimes = @[@0.0f, @0.33f, @0.66f, @1.0f];
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-deltaX, -deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(deltaX, -deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)]];
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circle 1
|
||||
{
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
// Circle 2 animation
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(deltaX, deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-deltaX, deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)]];
|
||||
|
||||
// Draw circle 2
|
||||
{
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallZigZagDeflectAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorBallZigZagDeflectAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,61 @@
|
||||
//
|
||||
// DGActivityIndicatorBallZigZagDeflectAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallZigZagDeflectAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallZigZagDeflectAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.75f;
|
||||
CGFloat circleSize = size.width / 5;
|
||||
CGFloat deltaX = size.width / 2 - circleSize / 2;
|
||||
CGFloat deltaY = size.height / 2 - circleSize / 2;
|
||||
|
||||
// Circle 1 animation
|
||||
CAKeyframeAnimation *animation = [self createKeyframeAnimationWithKeyPath:@"transform"];
|
||||
|
||||
animation.duration = duration;
|
||||
animation.keyTimes = @[@0.0f, @0.33f, @0.66f, @1.0f];
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-deltaX, -deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(deltaX, -deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)]];
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.autoreverses = true;
|
||||
|
||||
// Draw circle 1
|
||||
{
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
// Circle 2 animation
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(deltaX, deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-deltaX, deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)]];
|
||||
|
||||
// Draw circle 2
|
||||
{
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,14 @@
|
||||
//
|
||||
// DGActivityIndicatorCookieTerminatorAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/28.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorCookieTerminatorAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
|
||||
@end
|
@ -0,0 +1,80 @@
|
||||
//
|
||||
// DGActivityIndicatorCookieTerminatorAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/28.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorCookieTerminatorAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorCookieTerminatorAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat cookieTerminatorSize = ceilf(size.width / 3.0f);
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = layer.bounds.size.height / 2.0f;
|
||||
CGPoint cookieTerminatorCenter = CGPointMake(oX, oY);
|
||||
|
||||
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:cookieTerminatorCenter radius:cookieTerminatorSize startAngle:M_PI_4 endAngle:M_PI * 1.75f clockwise:YES];
|
||||
[path addLineToPoint:cookieTerminatorCenter];
|
||||
[path closePath];
|
||||
|
||||
CAShapeLayer *cookieTerminatorLayer = [CAShapeLayer layer];
|
||||
cookieTerminatorLayer.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
cookieTerminatorLayer.fillColor = tintColor.CGColor;
|
||||
cookieTerminatorLayer.path = path.CGPath;
|
||||
[layer addSublayer:cookieTerminatorLayer];
|
||||
|
||||
path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(0.0f, 0.0f) radius:cookieTerminatorSize startAngle:M_PI_2 endAngle:M_PI * 1.5f clockwise:YES];
|
||||
[path closePath];
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CAShapeLayer *jawLayer = [CAShapeLayer layer];
|
||||
jawLayer.path = path.CGPath;
|
||||
jawLayer.fillColor = tintColor.CGColor;
|
||||
jawLayer.position = cookieTerminatorCenter;
|
||||
jawLayer.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
jawLayer.opacity = 1.0f;
|
||||
jawLayer.transform = CATransform3DMakeRotation((1.0f - 2.0f * i) * M_PI_4, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
CABasicAnimation *transformAnimation = [self createBasicAnimationWithKeyPath:@"transform"];
|
||||
transformAnimation.beginTime = beginTime;
|
||||
transformAnimation.duration = 0.3f;
|
||||
transformAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation((1.0f - 2.0f * i) * M_PI_4, 0.0f, 0.0f, 1.0f)];
|
||||
transformAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation((1.0f - 2.0f * i) * M_PI_2, 0.0f, 0.0f, 1.0f)];
|
||||
transformAnimation.autoreverses = YES;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
[layer addSublayer:jawLayer];
|
||||
[jawLayer addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
|
||||
CGFloat cookieSize = ceilf(size.width / 6.0f);
|
||||
CGFloat cookiePadding = cookieSize * 2.0f;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CALayer *cookieLayer = [CALayer layer];
|
||||
cookieLayer.frame = CGRectMake(cookieTerminatorCenter.x + (cookieSize + cookiePadding) * 3.0f - cookieTerminatorSize, oY - cookieSize / 2.0f, cookieSize, cookieSize);
|
||||
cookieLayer.backgroundColor = tintColor.CGColor;
|
||||
cookieLayer.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
cookieLayer.opacity = 1.0f;
|
||||
cookieLayer.cornerRadius = cookieSize / 2.0f;
|
||||
|
||||
CABasicAnimation *transformAnimation = [self createBasicAnimationWithKeyPath:@"transform"];
|
||||
transformAnimation.duration = 1.8f;
|
||||
transformAnimation.beginTime = beginTime - (i * transformAnimation.duration / 3.0f);
|
||||
transformAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f)];
|
||||
transformAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-3.0f * (cookieSize + cookiePadding), 0.0f, 0.0f)];
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear];
|
||||
|
||||
[layer addSublayer:cookieLayer];
|
||||
[cookieLayer addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorDoubleBounceAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorDoubleBounceAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,50 @@
|
||||
//
|
||||
// DGActivityIndicatorDoubleBounceAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorDoubleBounceAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorDoubleBounceAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - size.height) / 2.0f;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
circle.frame = CGRectMake(oX, oY, size.width, size.height);
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 0.5f;
|
||||
circle.cornerRadius = size.height / 2.0f;
|
||||
circle.transform = CATransform3DMakeScale(0.0f, 0.0f, 0.0f);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [self createKeyframeAnimationWithKeyPath:@"transform"];
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.duration = 2.0f;
|
||||
transformAnimation.beginTime = beginTime - (1.0f * i);
|
||||
transformAnimation.keyTimes = @[@(0.0f), @(0.5f), @(1.0f)];
|
||||
|
||||
transformAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
|
||||
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0f, 0.0f, 0.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 0.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0f, 0.0f, 0.0f)]];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorFiveDotsAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorFiveDotsAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,97 @@
|
||||
//
|
||||
// DGActivityIndicatorFiveDotsAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorFiveDotsAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorFiveDotsAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat circleSize = size.width / 5.0f;
|
||||
|
||||
CGFloat oX = (layer.bounds.size.width - circleSize * 5) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - circleSize) / 2.0f;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
circle.frame = CGRectMake(oX + circleSize * 2 * i, oY, circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 1.0f;
|
||||
circle.cornerRadius = circle.bounds.size.height / 2.0f;
|
||||
|
||||
CATransform3D t1 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t1 = CATransform3DScale(t1, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t2 = CATransform3DMakeTranslation(0.0f, -2 * circleSize, 0.0f);
|
||||
t2 = CATransform3DScale(t2, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t3 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t3 = CATransform3DScale(t3, 0.3f, 0.3f, 0.0f);
|
||||
|
||||
CATransform3D t4 = CATransform3DMakeTranslation(0.0f, 2 * circleSize, 0.0f);
|
||||
t4 = CATransform3DScale(t4, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t5 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t5 = CATransform3DScale(t5, 1.f, 1.0f, 0.0f);
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [self createKeyframeAnimationWithKeyPath:@"transform"];
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:t1],
|
||||
[NSValue valueWithCATransform3D:t2],
|
||||
[NSValue valueWithCATransform3D:t3],
|
||||
[NSValue valueWithCATransform3D:t4],
|
||||
[NSValue valueWithCATransform3D:t5]];
|
||||
transformAnimation.beginTime = beginTime;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.duration = 1.0f;
|
||||
transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize * 5) / 2.0f + circleSize + circleSize * 2 * i, (layer.bounds.size.height - circleSize) / 2.0f, circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 1.0f;
|
||||
circle.cornerRadius = circle.bounds.size.height / 2.0f;
|
||||
|
||||
CATransform3D t1 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t1 = CATransform3DScale(t1, 0.3f, 0.3f, 0.0f);
|
||||
|
||||
CATransform3D t2 = CATransform3DMakeTranslation(0.0f, 2 * circleSize, 0.0f);
|
||||
t2 = CATransform3DScale(t2, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t3 = CATransform3DMakeTranslation(0.0f, -2 * circleSize, 0.0f);
|
||||
t3 = CATransform3DScale(t3, 1.f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t4 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t4 = CATransform3DScale(t4, 0.3f, 0.3f, 0.0f);
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [self createKeyframeAnimationWithKeyPath:@"transform"];
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:t1],
|
||||
[NSValue valueWithCATransform3D:t2],
|
||||
[NSValue valueWithCATransform3D:t3],
|
||||
[NSValue valueWithCATransform3D:t4]];
|
||||
transformAnimation.keyTimes = @[@(0.0f), @(0.25f), @(0.75f), @(1.0f)];
|
||||
transformAnimation.beginTime = beginTime;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.duration = 1.0f;
|
||||
transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScaleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimation.h"
|
||||
|
||||
@interface DGActivityIndicatorLineScaleAnimation: DGActivityIndicatorAnimation
|
||||
|
||||
@end
|
@ -0,0 +1,43 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScaleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorLineScaleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorLineScaleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
NSArray *beginTimes = @[@0.1f, @0.2f, @0.3f, @0.4f, @0.5f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.2f :0.68f :0.18f :1.08f];
|
||||
CGFloat lineSize = size.width / 9;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [self createKeyframeAnimationWithKeyPath:@"transform.scale.y"];
|
||||
|
||||
animation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
animation.values = @[@1.0f, @0.4f, @1.0f];
|
||||
animation.timingFunctions = @[timingFunction, timingFunction];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.duration = duration;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
CAShapeLayer *line = [CAShapeLayer layer];
|
||||
UIBezierPath *linePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, lineSize, size.height) cornerRadius:lineSize / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
line.fillColor = tintColor.CGColor;
|
||||
line.path = linePath.CGPath;
|
||||
[line addAnimation:animation forKey:@"animation"];
|
||||
line.frame = CGRectMake(x + lineSize * 2 * i, y, lineSize, size.height);
|
||||
[layer addSublayer:line];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user