├── .gitignore ├── KRKit.podspec ├── KRKit ├── KRKit.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── KRKit │ ├── Info.plist │ ├── Resource │ │ └── Images.xcassets │ │ │ └── images-small-loader.imageset │ │ │ ├── Contents.json │ │ │ └── images-small-loader@2x.png │ └── Source │ │ ├── Categories │ │ ├── Foundation │ │ │ ├── NSArray+KRKit.h │ │ │ ├── NSArray+KRKit.m │ │ │ ├── NSAttributedString+KRKit.h │ │ │ ├── NSAttributedString+KRKit.m │ │ │ ├── NSDictionary+KRKit.h │ │ │ ├── NSDictionary+KRKit.m │ │ │ ├── NSMutableArray+KRKit.h │ │ │ ├── NSMutableArray+KRKit.m │ │ │ ├── NSMutableAttributedString+KRKit.h │ │ │ ├── NSMutableAttributedString+KRKit.m │ │ │ ├── NSMutableDictionary+KRKit.h │ │ │ ├── NSMutableDictionary+KRKit.m │ │ │ ├── NSMutableString+KRKit.h │ │ │ ├── NSMutableString+KRKit.m │ │ │ ├── NSObject+KRKit.h │ │ │ ├── NSObject+KRKit.m │ │ │ ├── NSString+KRKit.h │ │ │ └── NSString+KRKit.m │ │ └── UIKit │ │ │ ├── UIColor+KRKit.h │ │ │ ├── UIColor+KRKit.m │ │ │ ├── UIImage+KRKit.h │ │ │ ├── UIImage+KRKit.m │ │ │ ├── UIImageView+KRKit.h │ │ │ ├── UIImageView+KRKit.m │ │ │ ├── UIView+KRKit.h │ │ │ └── UIView+KRKit.m │ │ ├── KRKit.h │ │ ├── Macro │ │ └── KRMacro.h │ │ └── UI Component │ │ ├── KRImageLabelView.h │ │ └── KRImageLabelView.m ├── KRKitDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── FirstViewController.h │ ├── FirstViewController.m │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── first.imageset │ │ │ ├── Contents.json │ │ │ └── first.pdf │ │ └── second.imageset │ │ │ ├── Contents.json │ │ │ └── second.pdf │ ├── Info.plist │ ├── KRKitDemo-prefix.pch │ ├── SecondViewController.h │ ├── SecondViewController.m │ └── main.m ├── KRKitDemoTests │ ├── Info.plist │ └── KRKitDemoTests.m └── KRKitTests │ ├── Info.plist │ └── KRKitTests.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /KRKit.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint KRKit.podspec' to ensure this is a 3 | # valid spec and remove all comments before submitting the spec. 4 | # 5 | # Any lines starting with a # are optional, but encouraged 6 | # 7 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 8 | # 9 | 10 | Pod::Spec.new do |s| 11 | s.name = "KRKit" 12 | s.version = "1.0" 13 | s.summary = "A short description of KRKit." 14 | s.description = <<-DESC 15 | An optional longer description of KRKit 16 | 17 | * Markdown format. 18 | * Don't worry about the indent, we strip it! 19 | DESC 20 | s.homepage = "https://github.com/36Kr-Mobile/KRKit" 21 | s.license = 'MIT' 22 | s.author = { "aidenluo" => "aidenluo177@gmail.com" } 23 | s.source = { :git => "https://github.com/36Kr-Mobile/KRKit.git", :tag => s.version.to_s } 24 | s.platform = :ios, '7.0' 25 | s.requires_arc = true 26 | 27 | s.ios.deployment_target = '7.0' 28 | 29 | s.source_files = 'KRKit/KRKit/Source/KRKit.h' 30 | s.public_header_files = 'KRKit/KRKit/Source/KRKit.h' 31 | 32 | s.subspec 'Categories' do |ss| 33 | 34 | ss.subspec 'Foundation' do |sss| 35 | sss.source_files = 'KRKit/KRKit/Source/Categories/Foundation/*.{h,m}' 36 | end 37 | 38 | ss.subspec 'UIKit' do |sss| 39 | sss.source_files = 'KRKit/KRKit/Source/Categories/UIKit/*.{h,m}' 40 | end 41 | 42 | end 43 | 44 | s.subspec 'Macro' do |ss| 45 | ss.source_files = 'KRKit/KRKit/Source/Macro/*.{h,m}' 46 | end 47 | 48 | s.subspec 'UI Component' do |ss| 49 | ss.source_files = 'KRKit/KRKit/Source/UI Component/*.{h,m}' 50 | end 51 | 52 | end 53 | -------------------------------------------------------------------------------- /KRKit/KRKit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 21F56C341AF22B6700E47BD8 /* UIImage+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 21F56C2E1AF22B6700E47BD8 /* UIImage+KRKit.h */; }; 11 | 21F56C351AF22B6700E47BD8 /* UIImage+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 21F56C2F1AF22B6700E47BD8 /* UIImage+KRKit.m */; }; 12 | 21F56C361AF22B6700E47BD8 /* UIImageView+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 21F56C301AF22B6700E47BD8 /* UIImageView+KRKit.h */; }; 13 | 21F56C371AF22B6700E47BD8 /* UIImageView+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 21F56C311AF22B6700E47BD8 /* UIImageView+KRKit.m */; }; 14 | 21F56C381AF22B6700E47BD8 /* UIView+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 21F56C321AF22B6700E47BD8 /* UIView+KRKit.h */; }; 15 | 21F56C391AF22B6700E47BD8 /* UIView+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 21F56C331AF22B6700E47BD8 /* UIView+KRKit.m */; }; 16 | BC6CBF871AF8C9C900BC45C5 /* UIColor+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6CBF851AF8C9C900BC45C5 /* UIColor+KRKit.h */; }; 17 | BC6CBF881AF8C9C900BC45C5 /* UIColor+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6CBF861AF8C9C900BC45C5 /* UIColor+KRKit.m */; }; 18 | BC79713C1AF1E3090073F077 /* KRKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC7971301AF1E3090073F077 /* KRKit.framework */; }; 19 | BC7971431AF1E3090073F077 /* KRKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7971421AF1E3090073F077 /* KRKitTests.m */; }; 20 | BC7971881AF2005A0073F077 /* NSArray+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7971751AF2005A0073F077 /* NSArray+KRKit.h */; }; 21 | BC7971891AF2005A0073F077 /* NSArray+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7971761AF2005A0073F077 /* NSArray+KRKit.m */; }; 22 | BC79718A1AF2005A0073F077 /* NSDictionary+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7971771AF2005A0073F077 /* NSDictionary+KRKit.h */; }; 23 | BC79718B1AF2005A0073F077 /* NSDictionary+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7971781AF2005A0073F077 /* NSDictionary+KRKit.m */; }; 24 | BC79718C1AF2005A0073F077 /* NSMutableArray+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7971791AF2005A0073F077 /* NSMutableArray+KRKit.h */; }; 25 | BC79718D1AF2005A0073F077 /* NSMutableArray+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC79717A1AF2005A0073F077 /* NSMutableArray+KRKit.m */; }; 26 | BC79718E1AF2005A0073F077 /* NSMutableDictionary+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC79717B1AF2005A0073F077 /* NSMutableDictionary+KRKit.h */; }; 27 | BC79718F1AF2005A0073F077 /* NSMutableDictionary+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC79717C1AF2005A0073F077 /* NSMutableDictionary+KRKit.m */; }; 28 | BC7971921AF2005A0073F077 /* NSMutableString+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC79717F1AF2005A0073F077 /* NSMutableString+KRKit.h */; }; 29 | BC7971931AF2005A0073F077 /* NSMutableString+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7971801AF2005A0073F077 /* NSMutableString+KRKit.m */; }; 30 | BC7971941AF2005A0073F077 /* NSObject+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7971811AF2005A0073F077 /* NSObject+KRKit.h */; }; 31 | BC7971951AF2005A0073F077 /* NSObject+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7971821AF2005A0073F077 /* NSObject+KRKit.m */; }; 32 | BC7971981AF2005A0073F077 /* NSString+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7971851AF2005A0073F077 /* NSString+KRKit.h */; }; 33 | BC7971991AF2005A0073F077 /* NSString+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7971861AF2005A0073F077 /* NSString+KRKit.m */; }; 34 | BC79719A1AF2005A0073F077 /* KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7971871AF2005A0073F077 /* KRKit.h */; }; 35 | BC7972051AF21FF10073F077 /* NSAttributedString+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7972031AF21FF10073F077 /* NSAttributedString+KRKit.h */; }; 36 | BC7972061AF21FF10073F077 /* NSAttributedString+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7972041AF21FF10073F077 /* NSAttributedString+KRKit.m */; }; 37 | BC7972091AF220630073F077 /* NSMutableAttributedString+KRKit.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7972071AF220630073F077 /* NSMutableAttributedString+KRKit.h */; }; 38 | BC79720A1AF220630073F077 /* NSMutableAttributedString+KRKit.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7972081AF220630073F077 /* NSMutableAttributedString+KRKit.m */; }; 39 | BCA862361B10150F00BD22DA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA862351B10150F00BD22DA /* main.m */; }; 40 | BCA862391B10150F00BD22DA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA862381B10150F00BD22DA /* AppDelegate.m */; }; 41 | BCA8623C1B10150F00BD22DA /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA8623B1B10150F00BD22DA /* FirstViewController.m */; }; 42 | BCA8623F1B10150F00BD22DA /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA8623E1B10150F00BD22DA /* SecondViewController.m */; }; 43 | BCA862421B10150F00BD22DA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BCA862401B10150F00BD22DA /* Main.storyboard */; }; 44 | BCA862441B10150F00BD22DA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BCA862431B10150F00BD22DA /* Images.xcassets */; }; 45 | BCA862471B10150F00BD22DA /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCA862451B10150F00BD22DA /* LaunchScreen.xib */; }; 46 | BCA862531B10150F00BD22DA /* KRKitDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA862521B10150F00BD22DA /* KRKitDemoTests.m */; }; 47 | BCA8625E1B10186300BD22DA /* KRKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC7971301AF1E3090073F077 /* KRKit.framework */; }; 48 | BCA862621B10187C00BD22DA /* KRKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BC7971301AF1E3090073F077 /* KRKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 49 | BCC159311AFB518A0084AC72 /* KRMacro.h in Sources */ = {isa = PBXBuildFile; fileRef = BCC159301AFB518A0084AC72 /* KRMacro.h */; }; 50 | BCCF014C1AFE2D3800941B4E /* KRImageLabelView.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF014A1AFE2D3800941B4E /* KRImageLabelView.h */; }; 51 | BCCF014D1AFE2D3800941B4E /* KRImageLabelView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCCF014B1AFE2D3800941B4E /* KRImageLabelView.m */; }; 52 | /* End PBXBuildFile section */ 53 | 54 | /* Begin PBXContainerItemProxy section */ 55 | BC79713D1AF1E3090073F077 /* PBXContainerItemProxy */ = { 56 | isa = PBXContainerItemProxy; 57 | containerPortal = BC7971271AF1E3080073F077 /* Project object */; 58 | proxyType = 1; 59 | remoteGlobalIDString = BC79712F1AF1E3090073F077; 60 | remoteInfo = KRKit; 61 | }; 62 | BCA8624D1B10150F00BD22DA /* PBXContainerItemProxy */ = { 63 | isa = PBXContainerItemProxy; 64 | containerPortal = BC7971271AF1E3080073F077 /* Project object */; 65 | proxyType = 1; 66 | remoteGlobalIDString = BCA862301B10150F00BD22DA; 67 | remoteInfo = KRKitDemo; 68 | }; 69 | BCA8625F1B10186600BD22DA /* PBXContainerItemProxy */ = { 70 | isa = PBXContainerItemProxy; 71 | containerPortal = BC7971271AF1E3080073F077 /* Project object */; 72 | proxyType = 1; 73 | remoteGlobalIDString = BC79712F1AF1E3090073F077; 74 | remoteInfo = KRKit; 75 | }; 76 | /* End PBXContainerItemProxy section */ 77 | 78 | /* Begin PBXCopyFilesBuildPhase section */ 79 | BCA862631B10187C00BD22DA /* Embed Frameworks */ = { 80 | isa = PBXCopyFilesBuildPhase; 81 | buildActionMask = 2147483647; 82 | dstPath = ""; 83 | dstSubfolderSpec = 10; 84 | files = ( 85 | BCA862621B10187C00BD22DA /* KRKit.framework in Embed Frameworks */, 86 | ); 87 | name = "Embed Frameworks"; 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | /* End PBXCopyFilesBuildPhase section */ 91 | 92 | /* Begin PBXFileReference section */ 93 | 21F56C2E1AF22B6700E47BD8 /* UIImage+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+KRKit.h"; sourceTree = ""; }; 94 | 21F56C2F1AF22B6700E47BD8 /* UIImage+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+KRKit.m"; sourceTree = ""; }; 95 | 21F56C301AF22B6700E47BD8 /* UIImageView+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+KRKit.h"; sourceTree = ""; }; 96 | 21F56C311AF22B6700E47BD8 /* UIImageView+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+KRKit.m"; sourceTree = ""; }; 97 | 21F56C321AF22B6700E47BD8 /* UIView+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+KRKit.h"; sourceTree = ""; }; 98 | 21F56C331AF22B6700E47BD8 /* UIView+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+KRKit.m"; sourceTree = ""; }; 99 | BC6CBF851AF8C9C900BC45C5 /* UIColor+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+KRKit.h"; sourceTree = ""; }; 100 | BC6CBF861AF8C9C900BC45C5 /* UIColor+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+KRKit.m"; sourceTree = ""; }; 101 | BC7971301AF1E3090073F077 /* KRKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KRKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 102 | BC7971341AF1E3090073F077 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 103 | BC79713B1AF1E3090073F077 /* KRKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KRKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 104 | BC7971411AF1E3090073F077 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 105 | BC7971421AF1E3090073F077 /* KRKitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KRKitTests.m; sourceTree = ""; }; 106 | BC7971751AF2005A0073F077 /* NSArray+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+KRKit.h"; sourceTree = ""; }; 107 | BC7971761AF2005A0073F077 /* NSArray+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+KRKit.m"; sourceTree = ""; }; 108 | BC7971771AF2005A0073F077 /* NSDictionary+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+KRKit.h"; sourceTree = ""; }; 109 | BC7971781AF2005A0073F077 /* NSDictionary+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+KRKit.m"; sourceTree = ""; }; 110 | BC7971791AF2005A0073F077 /* NSMutableArray+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+KRKit.h"; sourceTree = ""; }; 111 | BC79717A1AF2005A0073F077 /* NSMutableArray+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+KRKit.m"; sourceTree = ""; }; 112 | BC79717B1AF2005A0073F077 /* NSMutableDictionary+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+KRKit.h"; sourceTree = ""; }; 113 | BC79717C1AF2005A0073F077 /* NSMutableDictionary+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+KRKit.m"; sourceTree = ""; }; 114 | BC79717F1AF2005A0073F077 /* NSMutableString+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableString+KRKit.h"; sourceTree = ""; }; 115 | BC7971801AF2005A0073F077 /* NSMutableString+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableString+KRKit.m"; sourceTree = ""; }; 116 | BC7971811AF2005A0073F077 /* NSObject+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+KRKit.h"; sourceTree = ""; }; 117 | BC7971821AF2005A0073F077 /* NSObject+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+KRKit.m"; sourceTree = ""; }; 118 | BC7971851AF2005A0073F077 /* NSString+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+KRKit.h"; sourceTree = ""; }; 119 | BC7971861AF2005A0073F077 /* NSString+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+KRKit.m"; sourceTree = ""; }; 120 | BC7971871AF2005A0073F077 /* KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRKit.h; sourceTree = ""; }; 121 | BC7972031AF21FF10073F077 /* NSAttributedString+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSAttributedString+KRKit.h"; sourceTree = ""; }; 122 | BC7972041AF21FF10073F077 /* NSAttributedString+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSAttributedString+KRKit.m"; sourceTree = ""; }; 123 | BC7972071AF220630073F077 /* NSMutableAttributedString+KRKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableAttributedString+KRKit.h"; sourceTree = ""; }; 124 | BC7972081AF220630073F077 /* NSMutableAttributedString+KRKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableAttributedString+KRKit.m"; sourceTree = ""; }; 125 | BCA862311B10150F00BD22DA /* KRKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KRKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 126 | BCA862341B10150F00BD22DA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 127 | BCA862351B10150F00BD22DA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 128 | BCA862371B10150F00BD22DA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 129 | BCA862381B10150F00BD22DA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 130 | BCA8623A1B10150F00BD22DA /* FirstViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirstViewController.h; sourceTree = ""; }; 131 | BCA8623B1B10150F00BD22DA /* FirstViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirstViewController.m; sourceTree = ""; }; 132 | BCA8623D1B10150F00BD22DA /* SecondViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; 133 | BCA8623E1B10150F00BD22DA /* SecondViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; 134 | BCA862411B10150F00BD22DA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 135 | BCA862431B10150F00BD22DA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 136 | BCA862461B10150F00BD22DA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 137 | BCA8624C1B10150F00BD22DA /* KRKitDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KRKitDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 138 | BCA862511B10150F00BD22DA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 139 | BCA862521B10150F00BD22DA /* KRKitDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KRKitDemoTests.m; sourceTree = ""; }; 140 | BCA8625A1B1015A900BD22DA /* KRKitDemo-prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KRKitDemo-prefix.pch"; sourceTree = ""; }; 141 | BCC159301AFB518A0084AC72 /* KRMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRMacro.h; sourceTree = ""; }; 142 | BCCF014A1AFE2D3800941B4E /* KRImageLabelView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRImageLabelView.h; sourceTree = ""; }; 143 | BCCF014B1AFE2D3800941B4E /* KRImageLabelView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KRImageLabelView.m; sourceTree = ""; }; 144 | /* End PBXFileReference section */ 145 | 146 | /* Begin PBXFrameworksBuildPhase section */ 147 | BC79712C1AF1E3090073F077 /* Frameworks */ = { 148 | isa = PBXFrameworksBuildPhase; 149 | buildActionMask = 2147483647; 150 | files = ( 151 | ); 152 | runOnlyForDeploymentPostprocessing = 0; 153 | }; 154 | BC7971381AF1E3090073F077 /* Frameworks */ = { 155 | isa = PBXFrameworksBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | BC79713C1AF1E3090073F077 /* KRKit.framework in Frameworks */, 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | }; 162 | BCA8622E1B10150F00BD22DA /* Frameworks */ = { 163 | isa = PBXFrameworksBuildPhase; 164 | buildActionMask = 2147483647; 165 | files = ( 166 | BCA8625E1B10186300BD22DA /* KRKit.framework in Frameworks */, 167 | ); 168 | runOnlyForDeploymentPostprocessing = 0; 169 | }; 170 | BCA862491B10150F00BD22DA /* Frameworks */ = { 171 | isa = PBXFrameworksBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXFrameworksBuildPhase section */ 178 | 179 | /* Begin PBXGroup section */ 180 | 21F56C2D1AF22B6700E47BD8 /* UIKit */ = { 181 | isa = PBXGroup; 182 | children = ( 183 | 21F56C2E1AF22B6700E47BD8 /* UIImage+KRKit.h */, 184 | 21F56C2F1AF22B6700E47BD8 /* UIImage+KRKit.m */, 185 | 21F56C301AF22B6700E47BD8 /* UIImageView+KRKit.h */, 186 | 21F56C311AF22B6700E47BD8 /* UIImageView+KRKit.m */, 187 | 21F56C321AF22B6700E47BD8 /* UIView+KRKit.h */, 188 | 21F56C331AF22B6700E47BD8 /* UIView+KRKit.m */, 189 | BC6CBF851AF8C9C900BC45C5 /* UIColor+KRKit.h */, 190 | BC6CBF861AF8C9C900BC45C5 /* UIColor+KRKit.m */, 191 | ); 192 | path = UIKit; 193 | sourceTree = ""; 194 | }; 195 | BC7971261AF1E3080073F077 = { 196 | isa = PBXGroup; 197 | children = ( 198 | BC7971321AF1E3090073F077 /* KRKit */, 199 | BC79713F1AF1E3090073F077 /* KRKitTests */, 200 | BCA862321B10150F00BD22DA /* KRKitDemo */, 201 | BCA8624F1B10150F00BD22DA /* KRKitDemoTests */, 202 | BC7971311AF1E3090073F077 /* Products */, 203 | ); 204 | sourceTree = ""; 205 | }; 206 | BC7971311AF1E3090073F077 /* Products */ = { 207 | isa = PBXGroup; 208 | children = ( 209 | BC7971301AF1E3090073F077 /* KRKit.framework */, 210 | BC79713B1AF1E3090073F077 /* KRKitTests.xctest */, 211 | BCA862311B10150F00BD22DA /* KRKitDemo.app */, 212 | BCA8624C1B10150F00BD22DA /* KRKitDemoTests.xctest */, 213 | ); 214 | name = Products; 215 | sourceTree = ""; 216 | }; 217 | BC7971321AF1E3090073F077 /* KRKit */ = { 218 | isa = PBXGroup; 219 | children = ( 220 | BC7971721AF2005A0073F077 /* Source */, 221 | BC7971331AF1E3090073F077 /* Supporting Files */, 222 | ); 223 | path = KRKit; 224 | sourceTree = ""; 225 | }; 226 | BC7971331AF1E3090073F077 /* Supporting Files */ = { 227 | isa = PBXGroup; 228 | children = ( 229 | BC7971341AF1E3090073F077 /* Info.plist */, 230 | ); 231 | name = "Supporting Files"; 232 | sourceTree = ""; 233 | }; 234 | BC79713F1AF1E3090073F077 /* KRKitTests */ = { 235 | isa = PBXGroup; 236 | children = ( 237 | BC7971421AF1E3090073F077 /* KRKitTests.m */, 238 | BC7971401AF1E3090073F077 /* Supporting Files */, 239 | ); 240 | path = KRKitTests; 241 | sourceTree = ""; 242 | }; 243 | BC7971401AF1E3090073F077 /* Supporting Files */ = { 244 | isa = PBXGroup; 245 | children = ( 246 | BC7971411AF1E3090073F077 /* Info.plist */, 247 | ); 248 | name = "Supporting Files"; 249 | sourceTree = ""; 250 | }; 251 | BC7971721AF2005A0073F077 /* Source */ = { 252 | isa = PBXGroup; 253 | children = ( 254 | BC7971871AF2005A0073F077 /* KRKit.h */, 255 | BCCF01491AFE2CFF00941B4E /* UI Component */, 256 | BCC1592F1AFB51240084AC72 /* Macro */, 257 | BC7971731AF2005A0073F077 /* Categories */, 258 | ); 259 | path = Source; 260 | sourceTree = ""; 261 | }; 262 | BC7971731AF2005A0073F077 /* Categories */ = { 263 | isa = PBXGroup; 264 | children = ( 265 | BC7971741AF2005A0073F077 /* Foundation */, 266 | 21F56C2D1AF22B6700E47BD8 /* UIKit */, 267 | ); 268 | path = Categories; 269 | sourceTree = ""; 270 | }; 271 | BC7971741AF2005A0073F077 /* Foundation */ = { 272 | isa = PBXGroup; 273 | children = ( 274 | BC7971751AF2005A0073F077 /* NSArray+KRKit.h */, 275 | BC7971761AF2005A0073F077 /* NSArray+KRKit.m */, 276 | BC7971771AF2005A0073F077 /* NSDictionary+KRKit.h */, 277 | BC7971781AF2005A0073F077 /* NSDictionary+KRKit.m */, 278 | BC7971791AF2005A0073F077 /* NSMutableArray+KRKit.h */, 279 | BC79717A1AF2005A0073F077 /* NSMutableArray+KRKit.m */, 280 | BC79717B1AF2005A0073F077 /* NSMutableDictionary+KRKit.h */, 281 | BC79717C1AF2005A0073F077 /* NSMutableDictionary+KRKit.m */, 282 | BC79717F1AF2005A0073F077 /* NSMutableString+KRKit.h */, 283 | BC7971801AF2005A0073F077 /* NSMutableString+KRKit.m */, 284 | BC7971811AF2005A0073F077 /* NSObject+KRKit.h */, 285 | BC7971821AF2005A0073F077 /* NSObject+KRKit.m */, 286 | BC7971851AF2005A0073F077 /* NSString+KRKit.h */, 287 | BC7971861AF2005A0073F077 /* NSString+KRKit.m */, 288 | BC7972031AF21FF10073F077 /* NSAttributedString+KRKit.h */, 289 | BC7972041AF21FF10073F077 /* NSAttributedString+KRKit.m */, 290 | BC7972071AF220630073F077 /* NSMutableAttributedString+KRKit.h */, 291 | BC7972081AF220630073F077 /* NSMutableAttributedString+KRKit.m */, 292 | ); 293 | path = Foundation; 294 | sourceTree = ""; 295 | }; 296 | BCA862321B10150F00BD22DA /* KRKitDemo */ = { 297 | isa = PBXGroup; 298 | children = ( 299 | BCA862371B10150F00BD22DA /* AppDelegate.h */, 300 | BCA862381B10150F00BD22DA /* AppDelegate.m */, 301 | BCA8623A1B10150F00BD22DA /* FirstViewController.h */, 302 | BCA8623B1B10150F00BD22DA /* FirstViewController.m */, 303 | BCA8623D1B10150F00BD22DA /* SecondViewController.h */, 304 | BCA8623E1B10150F00BD22DA /* SecondViewController.m */, 305 | BCA862401B10150F00BD22DA /* Main.storyboard */, 306 | BCA862431B10150F00BD22DA /* Images.xcassets */, 307 | BCA862451B10150F00BD22DA /* LaunchScreen.xib */, 308 | BCA8625A1B1015A900BD22DA /* KRKitDemo-prefix.pch */, 309 | BCA862331B10150F00BD22DA /* Supporting Files */, 310 | ); 311 | path = KRKitDemo; 312 | sourceTree = ""; 313 | }; 314 | BCA862331B10150F00BD22DA /* Supporting Files */ = { 315 | isa = PBXGroup; 316 | children = ( 317 | BCA862341B10150F00BD22DA /* Info.plist */, 318 | BCA862351B10150F00BD22DA /* main.m */, 319 | ); 320 | name = "Supporting Files"; 321 | sourceTree = ""; 322 | }; 323 | BCA8624F1B10150F00BD22DA /* KRKitDemoTests */ = { 324 | isa = PBXGroup; 325 | children = ( 326 | BCA862521B10150F00BD22DA /* KRKitDemoTests.m */, 327 | BCA862501B10150F00BD22DA /* Supporting Files */, 328 | ); 329 | path = KRKitDemoTests; 330 | sourceTree = ""; 331 | }; 332 | BCA862501B10150F00BD22DA /* Supporting Files */ = { 333 | isa = PBXGroup; 334 | children = ( 335 | BCA862511B10150F00BD22DA /* Info.plist */, 336 | ); 337 | name = "Supporting Files"; 338 | sourceTree = ""; 339 | }; 340 | BCC1592F1AFB51240084AC72 /* Macro */ = { 341 | isa = PBXGroup; 342 | children = ( 343 | BCC159301AFB518A0084AC72 /* KRMacro.h */, 344 | ); 345 | path = Macro; 346 | sourceTree = ""; 347 | }; 348 | BCCF01491AFE2CFF00941B4E /* UI Component */ = { 349 | isa = PBXGroup; 350 | children = ( 351 | BCCF014A1AFE2D3800941B4E /* KRImageLabelView.h */, 352 | BCCF014B1AFE2D3800941B4E /* KRImageLabelView.m */, 353 | ); 354 | path = "UI Component"; 355 | sourceTree = ""; 356 | }; 357 | /* End PBXGroup section */ 358 | 359 | /* Begin PBXHeadersBuildPhase section */ 360 | BC79712D1AF1E3090073F077 /* Headers */ = { 361 | isa = PBXHeadersBuildPhase; 362 | buildActionMask = 2147483647; 363 | files = ( 364 | BC7971921AF2005A0073F077 /* NSMutableString+KRKit.h in Headers */, 365 | BC7972051AF21FF10073F077 /* NSAttributedString+KRKit.h in Headers */, 366 | BC7971881AF2005A0073F077 /* NSArray+KRKit.h in Headers */, 367 | BC79718C1AF2005A0073F077 /* NSMutableArray+KRKit.h in Headers */, 368 | BC79718E1AF2005A0073F077 /* NSMutableDictionary+KRKit.h in Headers */, 369 | 21F56C361AF22B6700E47BD8 /* UIImageView+KRKit.h in Headers */, 370 | BC6CBF871AF8C9C900BC45C5 /* UIColor+KRKit.h in Headers */, 371 | 21F56C381AF22B6700E47BD8 /* UIView+KRKit.h in Headers */, 372 | BC79719A1AF2005A0073F077 /* KRKit.h in Headers */, 373 | BCCF014C1AFE2D3800941B4E /* KRImageLabelView.h in Headers */, 374 | BC7971941AF2005A0073F077 /* NSObject+KRKit.h in Headers */, 375 | BC7972091AF220630073F077 /* NSMutableAttributedString+KRKit.h in Headers */, 376 | BC79718A1AF2005A0073F077 /* NSDictionary+KRKit.h in Headers */, 377 | BC7971981AF2005A0073F077 /* NSString+KRKit.h in Headers */, 378 | 21F56C341AF22B6700E47BD8 /* UIImage+KRKit.h in Headers */, 379 | ); 380 | runOnlyForDeploymentPostprocessing = 0; 381 | }; 382 | BC7971F71AF205AE0073F077 /* Headers */ = { 383 | isa = PBXHeadersBuildPhase; 384 | buildActionMask = 2147483647; 385 | files = ( 386 | ); 387 | runOnlyForDeploymentPostprocessing = 0; 388 | }; 389 | /* End PBXHeadersBuildPhase section */ 390 | 391 | /* Begin PBXNativeTarget section */ 392 | BC79712F1AF1E3090073F077 /* KRKit */ = { 393 | isa = PBXNativeTarget; 394 | buildConfigurationList = BC7971461AF1E3090073F077 /* Build configuration list for PBXNativeTarget "KRKit" */; 395 | buildPhases = ( 396 | BC79712B1AF1E3090073F077 /* Sources */, 397 | BC79712C1AF1E3090073F077 /* Frameworks */, 398 | BC79712D1AF1E3090073F077 /* Headers */, 399 | BC79712E1AF1E3090073F077 /* Resources */, 400 | ); 401 | buildRules = ( 402 | ); 403 | dependencies = ( 404 | ); 405 | name = KRKit; 406 | productName = KRKit; 407 | productReference = BC7971301AF1E3090073F077 /* KRKit.framework */; 408 | productType = "com.apple.product-type.framework"; 409 | }; 410 | BC79713A1AF1E3090073F077 /* KRKitTests */ = { 411 | isa = PBXNativeTarget; 412 | buildConfigurationList = BC7971491AF1E3090073F077 /* Build configuration list for PBXNativeTarget "KRKitTests" */; 413 | buildPhases = ( 414 | BC7971371AF1E3090073F077 /* Sources */, 415 | BC7971381AF1E3090073F077 /* Frameworks */, 416 | BC7971391AF1E3090073F077 /* Resources */, 417 | BC7971F71AF205AE0073F077 /* Headers */, 418 | ); 419 | buildRules = ( 420 | ); 421 | dependencies = ( 422 | BC79713E1AF1E3090073F077 /* PBXTargetDependency */, 423 | ); 424 | name = KRKitTests; 425 | productName = KRKitTests; 426 | productReference = BC79713B1AF1E3090073F077 /* KRKitTests.xctest */; 427 | productType = "com.apple.product-type.bundle.unit-test"; 428 | }; 429 | BCA862301B10150F00BD22DA /* KRKitDemo */ = { 430 | isa = PBXNativeTarget; 431 | buildConfigurationList = BCA862581B10150F00BD22DA /* Build configuration list for PBXNativeTarget "KRKitDemo" */; 432 | buildPhases = ( 433 | BCA8622D1B10150F00BD22DA /* Sources */, 434 | BCA8622E1B10150F00BD22DA /* Frameworks */, 435 | BCA8622F1B10150F00BD22DA /* Resources */, 436 | BCA862631B10187C00BD22DA /* Embed Frameworks */, 437 | ); 438 | buildRules = ( 439 | ); 440 | dependencies = ( 441 | BCA862601B10186600BD22DA /* PBXTargetDependency */, 442 | ); 443 | name = KRKitDemo; 444 | productName = KRKitDemo; 445 | productReference = BCA862311B10150F00BD22DA /* KRKitDemo.app */; 446 | productType = "com.apple.product-type.application"; 447 | }; 448 | BCA8624B1B10150F00BD22DA /* KRKitDemoTests */ = { 449 | isa = PBXNativeTarget; 450 | buildConfigurationList = BCA862591B10150F00BD22DA /* Build configuration list for PBXNativeTarget "KRKitDemoTests" */; 451 | buildPhases = ( 452 | BCA862481B10150F00BD22DA /* Sources */, 453 | BCA862491B10150F00BD22DA /* Frameworks */, 454 | BCA8624A1B10150F00BD22DA /* Resources */, 455 | ); 456 | buildRules = ( 457 | ); 458 | dependencies = ( 459 | BCA8624E1B10150F00BD22DA /* PBXTargetDependency */, 460 | ); 461 | name = KRKitDemoTests; 462 | productName = KRKitDemoTests; 463 | productReference = BCA8624C1B10150F00BD22DA /* KRKitDemoTests.xctest */; 464 | productType = "com.apple.product-type.bundle.unit-test"; 465 | }; 466 | /* End PBXNativeTarget section */ 467 | 468 | /* Begin PBXProject section */ 469 | BC7971271AF1E3080073F077 /* Project object */ = { 470 | isa = PBXProject; 471 | attributes = { 472 | LastUpgradeCheck = 0630; 473 | ORGANIZATIONNAME = 36kr; 474 | TargetAttributes = { 475 | BC79712F1AF1E3090073F077 = { 476 | CreatedOnToolsVersion = 6.3.1; 477 | }; 478 | BC79713A1AF1E3090073F077 = { 479 | CreatedOnToolsVersion = 6.3.1; 480 | }; 481 | BCA862301B10150F00BD22DA = { 482 | CreatedOnToolsVersion = 6.3.1; 483 | }; 484 | BCA8624B1B10150F00BD22DA = { 485 | CreatedOnToolsVersion = 6.3.1; 486 | TestTargetID = BCA862301B10150F00BD22DA; 487 | }; 488 | }; 489 | }; 490 | buildConfigurationList = BC79712A1AF1E3080073F077 /* Build configuration list for PBXProject "KRKit" */; 491 | compatibilityVersion = "Xcode 3.2"; 492 | developmentRegion = English; 493 | hasScannedForEncodings = 0; 494 | knownRegions = ( 495 | en, 496 | Base, 497 | ); 498 | mainGroup = BC7971261AF1E3080073F077; 499 | productRefGroup = BC7971311AF1E3090073F077 /* Products */; 500 | projectDirPath = ""; 501 | projectRoot = ""; 502 | targets = ( 503 | BC79712F1AF1E3090073F077 /* KRKit */, 504 | BC79713A1AF1E3090073F077 /* KRKitTests */, 505 | BCA862301B10150F00BD22DA /* KRKitDemo */, 506 | BCA8624B1B10150F00BD22DA /* KRKitDemoTests */, 507 | ); 508 | }; 509 | /* End PBXProject section */ 510 | 511 | /* Begin PBXResourcesBuildPhase section */ 512 | BC79712E1AF1E3090073F077 /* Resources */ = { 513 | isa = PBXResourcesBuildPhase; 514 | buildActionMask = 2147483647; 515 | files = ( 516 | ); 517 | runOnlyForDeploymentPostprocessing = 0; 518 | }; 519 | BC7971391AF1E3090073F077 /* Resources */ = { 520 | isa = PBXResourcesBuildPhase; 521 | buildActionMask = 2147483647; 522 | files = ( 523 | ); 524 | runOnlyForDeploymentPostprocessing = 0; 525 | }; 526 | BCA8622F1B10150F00BD22DA /* Resources */ = { 527 | isa = PBXResourcesBuildPhase; 528 | buildActionMask = 2147483647; 529 | files = ( 530 | BCA862421B10150F00BD22DA /* Main.storyboard in Resources */, 531 | BCA862471B10150F00BD22DA /* LaunchScreen.xib in Resources */, 532 | BCA862441B10150F00BD22DA /* Images.xcassets in Resources */, 533 | ); 534 | runOnlyForDeploymentPostprocessing = 0; 535 | }; 536 | BCA8624A1B10150F00BD22DA /* Resources */ = { 537 | isa = PBXResourcesBuildPhase; 538 | buildActionMask = 2147483647; 539 | files = ( 540 | ); 541 | runOnlyForDeploymentPostprocessing = 0; 542 | }; 543 | /* End PBXResourcesBuildPhase section */ 544 | 545 | /* Begin PBXSourcesBuildPhase section */ 546 | BC79712B1AF1E3090073F077 /* Sources */ = { 547 | isa = PBXSourcesBuildPhase; 548 | buildActionMask = 2147483647; 549 | files = ( 550 | BC79718B1AF2005A0073F077 /* NSDictionary+KRKit.m in Sources */, 551 | BC7971891AF2005A0073F077 /* NSArray+KRKit.m in Sources */, 552 | BC7971991AF2005A0073F077 /* NSString+KRKit.m in Sources */, 553 | BCC159311AFB518A0084AC72 /* KRMacro.h in Sources */, 554 | BCCF014D1AFE2D3800941B4E /* KRImageLabelView.m in Sources */, 555 | BC6CBF881AF8C9C900BC45C5 /* UIColor+KRKit.m in Sources */, 556 | BC79718D1AF2005A0073F077 /* NSMutableArray+KRKit.m in Sources */, 557 | BC7971931AF2005A0073F077 /* NSMutableString+KRKit.m in Sources */, 558 | BC79720A1AF220630073F077 /* NSMutableAttributedString+KRKit.m in Sources */, 559 | BC7972061AF21FF10073F077 /* NSAttributedString+KRKit.m in Sources */, 560 | 21F56C371AF22B6700E47BD8 /* UIImageView+KRKit.m in Sources */, 561 | 21F56C351AF22B6700E47BD8 /* UIImage+KRKit.m in Sources */, 562 | BC79718F1AF2005A0073F077 /* NSMutableDictionary+KRKit.m in Sources */, 563 | 21F56C391AF22B6700E47BD8 /* UIView+KRKit.m in Sources */, 564 | BC7971951AF2005A0073F077 /* NSObject+KRKit.m in Sources */, 565 | ); 566 | runOnlyForDeploymentPostprocessing = 0; 567 | }; 568 | BC7971371AF1E3090073F077 /* Sources */ = { 569 | isa = PBXSourcesBuildPhase; 570 | buildActionMask = 2147483647; 571 | files = ( 572 | BC7971431AF1E3090073F077 /* KRKitTests.m in Sources */, 573 | ); 574 | runOnlyForDeploymentPostprocessing = 0; 575 | }; 576 | BCA8622D1B10150F00BD22DA /* Sources */ = { 577 | isa = PBXSourcesBuildPhase; 578 | buildActionMask = 2147483647; 579 | files = ( 580 | BCA8623F1B10150F00BD22DA /* SecondViewController.m in Sources */, 581 | BCA862391B10150F00BD22DA /* AppDelegate.m in Sources */, 582 | BCA8623C1B10150F00BD22DA /* FirstViewController.m in Sources */, 583 | BCA862361B10150F00BD22DA /* main.m in Sources */, 584 | ); 585 | runOnlyForDeploymentPostprocessing = 0; 586 | }; 587 | BCA862481B10150F00BD22DA /* Sources */ = { 588 | isa = PBXSourcesBuildPhase; 589 | buildActionMask = 2147483647; 590 | files = ( 591 | BCA862531B10150F00BD22DA /* KRKitDemoTests.m in Sources */, 592 | ); 593 | runOnlyForDeploymentPostprocessing = 0; 594 | }; 595 | /* End PBXSourcesBuildPhase section */ 596 | 597 | /* Begin PBXTargetDependency section */ 598 | BC79713E1AF1E3090073F077 /* PBXTargetDependency */ = { 599 | isa = PBXTargetDependency; 600 | target = BC79712F1AF1E3090073F077 /* KRKit */; 601 | targetProxy = BC79713D1AF1E3090073F077 /* PBXContainerItemProxy */; 602 | }; 603 | BCA8624E1B10150F00BD22DA /* PBXTargetDependency */ = { 604 | isa = PBXTargetDependency; 605 | target = BCA862301B10150F00BD22DA /* KRKitDemo */; 606 | targetProxy = BCA8624D1B10150F00BD22DA /* PBXContainerItemProxy */; 607 | }; 608 | BCA862601B10186600BD22DA /* PBXTargetDependency */ = { 609 | isa = PBXTargetDependency; 610 | target = BC79712F1AF1E3090073F077 /* KRKit */; 611 | targetProxy = BCA8625F1B10186600BD22DA /* PBXContainerItemProxy */; 612 | }; 613 | /* End PBXTargetDependency section */ 614 | 615 | /* Begin PBXVariantGroup section */ 616 | BCA862401B10150F00BD22DA /* Main.storyboard */ = { 617 | isa = PBXVariantGroup; 618 | children = ( 619 | BCA862411B10150F00BD22DA /* Base */, 620 | ); 621 | name = Main.storyboard; 622 | sourceTree = ""; 623 | }; 624 | BCA862451B10150F00BD22DA /* LaunchScreen.xib */ = { 625 | isa = PBXVariantGroup; 626 | children = ( 627 | BCA862461B10150F00BD22DA /* Base */, 628 | ); 629 | name = LaunchScreen.xib; 630 | sourceTree = ""; 631 | }; 632 | /* End PBXVariantGroup section */ 633 | 634 | /* Begin XCBuildConfiguration section */ 635 | BC7971441AF1E3090073F077 /* Debug */ = { 636 | isa = XCBuildConfiguration; 637 | buildSettings = { 638 | ALWAYS_SEARCH_USER_PATHS = NO; 639 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 640 | CLANG_CXX_LIBRARY = "libc++"; 641 | CLANG_ENABLE_MODULES = YES; 642 | CLANG_ENABLE_OBJC_ARC = YES; 643 | CLANG_WARN_BOOL_CONVERSION = YES; 644 | CLANG_WARN_CONSTANT_CONVERSION = YES; 645 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 646 | CLANG_WARN_EMPTY_BODY = YES; 647 | CLANG_WARN_ENUM_CONVERSION = YES; 648 | CLANG_WARN_INT_CONVERSION = YES; 649 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 650 | CLANG_WARN_UNREACHABLE_CODE = YES; 651 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 652 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 653 | COPY_PHASE_STRIP = NO; 654 | CURRENT_PROJECT_VERSION = 1; 655 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 656 | ENABLE_STRICT_OBJC_MSGSEND = YES; 657 | GCC_C_LANGUAGE_STANDARD = gnu99; 658 | GCC_DYNAMIC_NO_PIC = NO; 659 | GCC_NO_COMMON_BLOCKS = YES; 660 | GCC_OPTIMIZATION_LEVEL = 0; 661 | GCC_PREPROCESSOR_DEFINITIONS = ( 662 | "DEBUG=1", 663 | "$(inherited)", 664 | ); 665 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 666 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 667 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 668 | GCC_WARN_UNDECLARED_SELECTOR = YES; 669 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 670 | GCC_WARN_UNUSED_FUNCTION = YES; 671 | GCC_WARN_UNUSED_VARIABLE = YES; 672 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 673 | MTL_ENABLE_DEBUG_INFO = YES; 674 | ONLY_ACTIVE_ARCH = YES; 675 | SDKROOT = iphoneos; 676 | TARGETED_DEVICE_FAMILY = "1,2"; 677 | VERSIONING_SYSTEM = "apple-generic"; 678 | VERSION_INFO_PREFIX = ""; 679 | }; 680 | name = Debug; 681 | }; 682 | BC7971451AF1E3090073F077 /* Release */ = { 683 | isa = XCBuildConfiguration; 684 | buildSettings = { 685 | ALWAYS_SEARCH_USER_PATHS = NO; 686 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 687 | CLANG_CXX_LIBRARY = "libc++"; 688 | CLANG_ENABLE_MODULES = YES; 689 | CLANG_ENABLE_OBJC_ARC = YES; 690 | CLANG_WARN_BOOL_CONVERSION = YES; 691 | CLANG_WARN_CONSTANT_CONVERSION = YES; 692 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 693 | CLANG_WARN_EMPTY_BODY = YES; 694 | CLANG_WARN_ENUM_CONVERSION = YES; 695 | CLANG_WARN_INT_CONVERSION = YES; 696 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 697 | CLANG_WARN_UNREACHABLE_CODE = YES; 698 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 699 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 700 | COPY_PHASE_STRIP = NO; 701 | CURRENT_PROJECT_VERSION = 1; 702 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 703 | ENABLE_NS_ASSERTIONS = NO; 704 | ENABLE_STRICT_OBJC_MSGSEND = YES; 705 | GCC_C_LANGUAGE_STANDARD = gnu99; 706 | GCC_NO_COMMON_BLOCKS = YES; 707 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 708 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 709 | GCC_WARN_UNDECLARED_SELECTOR = YES; 710 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 711 | GCC_WARN_UNUSED_FUNCTION = YES; 712 | GCC_WARN_UNUSED_VARIABLE = YES; 713 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 714 | MTL_ENABLE_DEBUG_INFO = NO; 715 | SDKROOT = iphoneos; 716 | TARGETED_DEVICE_FAMILY = "1,2"; 717 | VALIDATE_PRODUCT = YES; 718 | VERSIONING_SYSTEM = "apple-generic"; 719 | VERSION_INFO_PREFIX = ""; 720 | }; 721 | name = Release; 722 | }; 723 | BC7971471AF1E3090073F077 /* Debug */ = { 724 | isa = XCBuildConfiguration; 725 | buildSettings = { 726 | DEFINES_MODULE = YES; 727 | DYLIB_COMPATIBILITY_VERSION = 1; 728 | DYLIB_CURRENT_VERSION = 1; 729 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 730 | INFOPLIST_FILE = KRKit/Info.plist; 731 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 732 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 733 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 734 | PRODUCT_NAME = "$(TARGET_NAME)"; 735 | SKIP_INSTALL = YES; 736 | }; 737 | name = Debug; 738 | }; 739 | BC7971481AF1E3090073F077 /* Release */ = { 740 | isa = XCBuildConfiguration; 741 | buildSettings = { 742 | DEFINES_MODULE = YES; 743 | DYLIB_COMPATIBILITY_VERSION = 1; 744 | DYLIB_CURRENT_VERSION = 1; 745 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 746 | INFOPLIST_FILE = KRKit/Info.plist; 747 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 748 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 749 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 750 | PRODUCT_NAME = "$(TARGET_NAME)"; 751 | SKIP_INSTALL = YES; 752 | }; 753 | name = Release; 754 | }; 755 | BC79714A1AF1E3090073F077 /* Debug */ = { 756 | isa = XCBuildConfiguration; 757 | buildSettings = { 758 | FRAMEWORK_SEARCH_PATHS = ( 759 | "$(SDKROOT)/Developer/Library/Frameworks", 760 | "$(inherited)", 761 | ); 762 | GCC_PREPROCESSOR_DEFINITIONS = ( 763 | "DEBUG=1", 764 | "$(inherited)", 765 | ); 766 | INFOPLIST_FILE = KRKitTests/Info.plist; 767 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 768 | PRODUCT_NAME = "$(TARGET_NAME)"; 769 | }; 770 | name = Debug; 771 | }; 772 | BC79714B1AF1E3090073F077 /* Release */ = { 773 | isa = XCBuildConfiguration; 774 | buildSettings = { 775 | FRAMEWORK_SEARCH_PATHS = ( 776 | "$(SDKROOT)/Developer/Library/Frameworks", 777 | "$(inherited)", 778 | ); 779 | INFOPLIST_FILE = KRKitTests/Info.plist; 780 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 781 | PRODUCT_NAME = "$(TARGET_NAME)"; 782 | }; 783 | name = Release; 784 | }; 785 | BCA862541B10150F00BD22DA /* Debug */ = { 786 | isa = XCBuildConfiguration; 787 | buildSettings = { 788 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 789 | GCC_PREFIX_HEADER = "${SRCROOT}/KRKitDemo/KRKitDemo-prefix.pch"; 790 | GCC_PREPROCESSOR_DEFINITIONS = ( 791 | "DEBUG=1", 792 | "$(inherited)", 793 | ); 794 | INFOPLIST_FILE = KRKitDemo/Info.plist; 795 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 796 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 797 | PRODUCT_NAME = "$(TARGET_NAME)"; 798 | }; 799 | name = Debug; 800 | }; 801 | BCA862551B10150F00BD22DA /* Release */ = { 802 | isa = XCBuildConfiguration; 803 | buildSettings = { 804 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 805 | GCC_PREFIX_HEADER = "${SRCROOT}/KRKitDemo/KRKitDemo-prefix.pch"; 806 | INFOPLIST_FILE = KRKitDemo/Info.plist; 807 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 808 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 809 | PRODUCT_NAME = "$(TARGET_NAME)"; 810 | }; 811 | name = Release; 812 | }; 813 | BCA862561B10150F00BD22DA /* Debug */ = { 814 | isa = XCBuildConfiguration; 815 | buildSettings = { 816 | BUNDLE_LOADER = "$(TEST_HOST)"; 817 | FRAMEWORK_SEARCH_PATHS = ( 818 | "$(SDKROOT)/Developer/Library/Frameworks", 819 | "$(inherited)", 820 | ); 821 | GCC_PREPROCESSOR_DEFINITIONS = ( 822 | "DEBUG=1", 823 | "$(inherited)", 824 | ); 825 | INFOPLIST_FILE = KRKitDemoTests/Info.plist; 826 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 827 | PRODUCT_NAME = "$(TARGET_NAME)"; 828 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KRKitDemo.app/KRKitDemo"; 829 | }; 830 | name = Debug; 831 | }; 832 | BCA862571B10150F00BD22DA /* Release */ = { 833 | isa = XCBuildConfiguration; 834 | buildSettings = { 835 | BUNDLE_LOADER = "$(TEST_HOST)"; 836 | FRAMEWORK_SEARCH_PATHS = ( 837 | "$(SDKROOT)/Developer/Library/Frameworks", 838 | "$(inherited)", 839 | ); 840 | INFOPLIST_FILE = KRKitDemoTests/Info.plist; 841 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 842 | PRODUCT_NAME = "$(TARGET_NAME)"; 843 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KRKitDemo.app/KRKitDemo"; 844 | }; 845 | name = Release; 846 | }; 847 | /* End XCBuildConfiguration section */ 848 | 849 | /* Begin XCConfigurationList section */ 850 | BC79712A1AF1E3080073F077 /* Build configuration list for PBXProject "KRKit" */ = { 851 | isa = XCConfigurationList; 852 | buildConfigurations = ( 853 | BC7971441AF1E3090073F077 /* Debug */, 854 | BC7971451AF1E3090073F077 /* Release */, 855 | ); 856 | defaultConfigurationIsVisible = 0; 857 | defaultConfigurationName = Release; 858 | }; 859 | BC7971461AF1E3090073F077 /* Build configuration list for PBXNativeTarget "KRKit" */ = { 860 | isa = XCConfigurationList; 861 | buildConfigurations = ( 862 | BC7971471AF1E3090073F077 /* Debug */, 863 | BC7971481AF1E3090073F077 /* Release */, 864 | ); 865 | defaultConfigurationIsVisible = 0; 866 | defaultConfigurationName = Release; 867 | }; 868 | BC7971491AF1E3090073F077 /* Build configuration list for PBXNativeTarget "KRKitTests" */ = { 869 | isa = XCConfigurationList; 870 | buildConfigurations = ( 871 | BC79714A1AF1E3090073F077 /* Debug */, 872 | BC79714B1AF1E3090073F077 /* Release */, 873 | ); 874 | defaultConfigurationIsVisible = 0; 875 | defaultConfigurationName = Release; 876 | }; 877 | BCA862581B10150F00BD22DA /* Build configuration list for PBXNativeTarget "KRKitDemo" */ = { 878 | isa = XCConfigurationList; 879 | buildConfigurations = ( 880 | BCA862541B10150F00BD22DA /* Debug */, 881 | BCA862551B10150F00BD22DA /* Release */, 882 | ); 883 | defaultConfigurationIsVisible = 0; 884 | }; 885 | BCA862591B10150F00BD22DA /* Build configuration list for PBXNativeTarget "KRKitDemoTests" */ = { 886 | isa = XCConfigurationList; 887 | buildConfigurations = ( 888 | BCA862561B10150F00BD22DA /* Debug */, 889 | BCA862571B10150F00BD22DA /* Release */, 890 | ); 891 | defaultConfigurationIsVisible = 0; 892 | }; 893 | /* End XCConfigurationList section */ 894 | }; 895 | rootObject = BC7971271AF1E3080073F077 /* Project object */; 896 | } 897 | -------------------------------------------------------------------------------- /KRKit/KRKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /KRKit/KRKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.36kr.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /KRKit/KRKit/Resource/Images.xcassets/images-small-loader.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "images-small-loader@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KRKit/KRKit/Resource/Images.xcassets/images-small-loader.imageset/images-small-loader@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/36Kr-Mobile/KRKit/9e38e05f81caccbb7c6c6e515b1b7b231ee4fca8/KRKit/KRKit/Resource/Images.xcassets/images-small-loader.imageset/images-small-loader@2x.png -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSArray+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+KRKit.h 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | @import Foundation; 10 | 11 | @interface NSArray (KRKit) 12 | 13 | - (id)kr_firstObject; 14 | - (id)kr_randomObject; 15 | - (id)kr_objectAtIndex:(NSUInteger)index; 16 | 17 | - (BOOL)kr_isEmpty; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSArray+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+KRKit.m 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | #import "NSArray+KRKit.h" 10 | 11 | @implementation NSArray (KRKit) 12 | 13 | - (id)kr_firstObject 14 | { 15 | if (self.count<1) { 16 | return nil; 17 | } 18 | return self[0]; 19 | } 20 | 21 | - (id)kr_randomObject 22 | { 23 | if (self.count<1) { 24 | return nil; 25 | } 26 | return self[arc4random() % [self count]]; 27 | } 28 | 29 | - (id)kr_objectAtIndex:(NSUInteger)index 30 | { 31 | if (index < self.count) { 32 | return [self objectAtIndex:index]; 33 | } 34 | return nil; 35 | } 36 | 37 | - (BOOL)kr_isEmpty 38 | { 39 | return [self count] == 0 ? YES : NO; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSAttributedString+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedString+KRKit.h 3 | // KRKit 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | @import Foundation; 10 | @import UIKit; 11 | 12 | @interface NSAttributedString (KRKit) 13 | 14 | + (NSAttributedString*)kr_attributedStringWithText:(NSString*)text lineHeight:(CGFloat)space; 15 | + (NSAttributedString*)kr_attributedStringWithText:(NSString *)text kerning:(CGFloat)kerning; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSAttributedString+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedString+KRKit.m 3 | // KRKit 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import "NSAttributedString+KRKit.h" 10 | 11 | @implementation NSAttributedString (KRKit) 12 | 13 | + (NSAttributedString*)kr_attributedStringWithText:(NSString*)text lineHeight:(CGFloat)space 14 | { 15 | if(text.length < 1) return nil; 16 | NSMutableParagraphStyle *paragrahStyle = [[NSMutableParagraphStyle alloc] init]; 17 | [paragrahStyle setLineSpacing:space]; 18 | NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text]; 19 | [attr addAttribute:NSParagraphStyleAttributeName value:paragrahStyle range:NSMakeRange(0,attr.length)]; 20 | return attr; 21 | } 22 | 23 | + (NSAttributedString*)kr_attributedStringWithText:(NSString *)text kerning:(CGFloat)kerning 24 | { 25 | if(text.length < 1) return nil; 26 | NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text]; 27 | [attr addAttribute:NSKernAttributeName value:@(kerning) range:NSMakeRange(0, text.length)]; 28 | return attr; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSDictionary+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+KRKit.h 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | @import Foundation; 10 | 11 | @interface NSDictionary (KRKit) 12 | 13 | - (BOOL)kr_containsObjectForKey:(id)key; 14 | - (BOOL)kr_isEmpty; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSDictionary+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+KRKit.m 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | #import "NSDictionary+KRKit.h" 10 | 11 | @implementation NSDictionary (KRKit) 12 | 13 | - (BOOL)kr_containsObjectForKey:(id)key 14 | { 15 | return [[self allKeys] containsObject:key]; 16 | } 17 | 18 | - (BOOL)kr_isEmpty 19 | { 20 | return [self count] == 0 ? YES : NO; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSMutableArray+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+KRKit.h 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | @import Foundation; 10 | 11 | @interface NSMutableArray (KRKit) 12 | 13 | - (void)kr_addObject:(id)anObject; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSMutableArray+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+KRKit.m 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | #import "NSMutableArray+KRKit.h" 10 | 11 | @implementation NSMutableArray (KRKit) 12 | 13 | - (void)kr_addObject:(id)anObject 14 | { 15 | if (anObject) { 16 | [self addObject:anObject]; 17 | } 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSMutableAttributedString+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableAttributedString+KRKit.h 3 | // KRKit 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | @import Foundation; 10 | @import UIKit; 11 | 12 | @interface NSMutableAttributedString (KRKit) 13 | 14 | - (void)kr_addTextColor:(UIColor*)color range:(NSRange)range; 15 | - (void)kr_addTextColor:(UIColor *)color; 16 | 17 | - (void)kr_addFont:(UIFont*)font range:(NSRange)range; 18 | - (void)kr_addFont:(UIFont*)font; 19 | 20 | - (void)kr_addKerning:(CGFloat)kerning range:(NSRange)range; 21 | - (void)kr_addKerning:(CGFloat)kerning; 22 | 23 | - (void)kr_addLineHeight:(CGFloat)lineHeight range:(NSRange)range; 24 | - (void)kr_addLineHeight:(CGFloat)lineHeight; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSMutableAttributedString+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableAttributedString+KRKit.m 3 | // KRKit 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import "NSMutableAttributedString+KRKit.h" 10 | 11 | @implementation NSMutableAttributedString (KRKit) 12 | 13 | - (void)kr_addTextColor:(UIColor*)color range:(NSRange)range 14 | { 15 | [self addAttribute:NSForegroundColorAttributeName value:color range:range]; 16 | } 17 | 18 | - (void)kr_addTextColor:(UIColor *)color 19 | { 20 | [self kr_addTextColor:color range:NSMakeRange(0, self.length)]; 21 | } 22 | 23 | - (void)kr_addFont:(UIFont*)font range:(NSRange)range 24 | { 25 | [self addAttribute:NSFontAttributeName value:font range:range]; 26 | } 27 | 28 | - (void)kr_addFont:(UIFont*)font 29 | { 30 | [self kr_addFont:font range:NSMakeRange(0, self.length)]; 31 | } 32 | 33 | - (void)kr_addKerning:(CGFloat)kerning range:(NSRange)range 34 | { 35 | [self addAttribute:NSKernAttributeName value:@(kerning) range:range]; 36 | } 37 | 38 | - (void)kr_addKerning:(CGFloat)kerning 39 | { 40 | [self kr_addKerning:kerning range:NSMakeRange(0, self.length)]; 41 | } 42 | 43 | - (void)kr_addLineHeight:(CGFloat)lineHeight range:(NSRange)range 44 | { 45 | NSMutableParagraphStyle *paragrahStyle = [[NSMutableParagraphStyle alloc] init]; 46 | [paragrahStyle setLineSpacing:lineHeight]; 47 | [self addAttribute:NSParagraphStyleAttributeName value:paragrahStyle range:range]; 48 | } 49 | 50 | - (void)kr_addLineHeight:(CGFloat)lineHeight 51 | { 52 | [self kr_addLineHeight:lineHeight range:NSMakeRange(0, self.length)]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSMutableDictionary+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableDictionary+KRKit.h 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | @import Foundation; 10 | 11 | @interface NSMutableDictionary (KRKit) 12 | 13 | - (void)kr_setObject:(id)anObject forKey:(id)aKey; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSMutableDictionary+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableDictionary+KRKit.m 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | #import "NSMutableDictionary+KRKit.h" 10 | 11 | @implementation NSMutableDictionary (KRKit) 12 | 13 | - (void)kr_setObject:(id)anObject forKey:(id)aKey 14 | { 15 | if (anObject && aKey) { 16 | [self setObject:anObject forKey:aKey]; 17 | } 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSMutableString+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableString+KRKit.h 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | @import Foundation; 10 | 11 | @interface NSMutableString (KRKit) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSMutableString+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableString+KRKit.m 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | #import "NSMutableString+KRKit.h" 10 | 11 | @implementation NSMutableString (KRKit) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSObject+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+KRKit.h 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | @import Foundation; 10 | 11 | @interface NSObject (KRKit) 12 | 13 | + (BOOL)kr_swizzleMethod:(SEL)origSel withMethod:(SEL)altSel; 14 | + (BOOL)kr_swizzleClassMethod:(SEL)origSel withClassMethod:(SEL)altSel; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSObject+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+KRKit.m 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | #import "NSObject+KRKit.h" 10 | #import 11 | 12 | @implementation NSObject (KRKit) 13 | 14 | + (BOOL)kr_swizzleMethod:(SEL)origSel withMethod:(SEL)altSel 15 | { 16 | Method origMethod = class_getInstanceMethod(self, origSel); 17 | if (!origMethod) { 18 | return NO; 19 | } 20 | 21 | Method altMethod = class_getInstanceMethod(self, altSel); 22 | if (!altMethod) { 23 | return NO; 24 | } 25 | 26 | class_addMethod(self, 27 | origSel, 28 | class_getMethodImplementation(self, origSel), 29 | method_getTypeEncoding(origMethod)); 30 | class_addMethod(self, 31 | altSel, 32 | class_getMethodImplementation(self, altSel), 33 | method_getTypeEncoding(altMethod)); 34 | 35 | method_exchangeImplementations(class_getInstanceMethod(self, origSel), class_getInstanceMethod(self, altSel)); 36 | return YES; 37 | } 38 | 39 | + (BOOL)kr_swizzleClassMethod:(SEL)origSel withClassMethod:(SEL)altSel 40 | { 41 | return [object_getClass((id)self) kr_swizzleMethod:origSel withMethod:altSel]; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSString+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+KRKit.h 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | @import Foundation; 10 | @import UIKit; 11 | 12 | @interface NSString (KRKit) 13 | 14 | - (NSURL *)kr_convertToURL; 15 | - (NSURL *)kr_convertToURLRelativeToURL:(NSURL*)baseURL; 16 | 17 | - (NSString *)kr_md5; 18 | - (NSString *)kr_URLEncode; 19 | - (NSString *)kr_encodeBase64; 20 | - (NSString *)kr_decodeBase64; 21 | 22 | - (BOOL)kr_isEmail; 23 | - (BOOL)kr_hasString:(NSString *)substring; 24 | - (BOOL)kr_isNotEmpty; 25 | 26 | - (CGFloat)kr_heightWithMaxWidth:(CGFloat)width attributes:(NSDictionary *)attributes; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/Foundation/NSString+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+KRKit.m 3 | // Pods 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // 7 | // 8 | 9 | #import "NSString+KRKit.h" 10 | #import 11 | 12 | @implementation NSString (KRKit) 13 | 14 | - (NSURL *)kr_convertToURL 15 | { 16 | if (self) { 17 | return [NSURL URLWithString:self]; 18 | }else { 19 | return nil; 20 | } 21 | } 22 | 23 | - (NSURL *)kr_convertToURLRelativeToURL:(NSURL*)baseURL 24 | { 25 | if(!baseURL) { 26 | return nil; 27 | } else { 28 | return [NSURL URLWithString:self relativeToURL:baseURL]; 29 | } 30 | } 31 | 32 | - (NSString *)kr_md5 33 | { 34 | unsigned char digest[CC_MD5_DIGEST_LENGTH], i; 35 | CC_MD5([self UTF8String], (uint32_t)[self lengthOfBytesUsingEncoding:NSUTF8StringEncoding], digest); 36 | NSMutableString *ms = [NSMutableString string]; 37 | for (i=0;i> 16)) / 255.0 21 | green:((float)((hex & 0xFF00) >> 8)) / 255.0 22 | blue:((float)(hex & 0xFF)) / 255.0 23 | alpha:alpha]; 24 | } 25 | 26 | + (UIColor *)kr_RandomColor 27 | { 28 | return [UIColor kr_RandomColorWithAlpha:1.0]; 29 | } 30 | 31 | + (UIColor*)kr_RandomColorWithAlpha:(CGFloat)alpha 32 | { 33 | 34 | NSInteger r = arc4random() % 255; 35 | NSInteger g = arc4random() % 255; 36 | NSInteger b = arc4random() % 255; 37 | return [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:alpha]; 38 | 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/UIKit/UIImage+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+KRKit.h 3 | // KRKit 4 | // 5 | // Created by 小普 on 15/4/30. 6 | // Copyright (c) 2015年 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (KRKit) 12 | 13 | + (UIImage *)kr_templateImageNamed:(NSString *)name; 14 | 15 | /* 16 | 缩小图片 17 | */ 18 | + (UIImage *)kr_scaleImage:(UIImage *)image asThubmnailWithHeight:(CGFloat)thumbnailHeight; 19 | 20 | + (UIImage *)kr_circularImage:(UIImage *)image withRadius:(CGFloat)radius withDiamter:(NSUInteger)diameter; 21 | 22 | + (UIImage *)kr_imageWithColor:(UIColor *)color; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/UIKit/UIImage+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+KRKit.m 3 | // KRKit 4 | // 5 | // Created by 小普 on 15/4/30. 6 | // Copyright (c) 2015年 36kr. All rights reserved. 7 | // 8 | 9 | #import "UIImage+KRKit.h" 10 | 11 | @implementation UIImage (KRKit) 12 | 13 | + (UIImage *)kr_templateImageNamed:(NSString *)name 14 | { 15 | return [[self imageNamed:name] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; 16 | } 17 | 18 | + (UIImage *)kr_scaleImage:(UIImage *)image asThubmnailWithHeight:(CGFloat)thumbnailHeight 19 | { 20 | //缩小图片 21 | if (!image) { 22 | return nil; 23 | } 24 | UIImage *sourceImage = image; 25 | UIImage *newImage = nil; 26 | 27 | CGFloat thumbnailWidth = image.size.width * thumbnailHeight / image.size.height; 28 | 29 | UIGraphicsBeginImageContext(CGSizeMake(thumbnailWidth, thumbnailHeight)); 30 | 31 | CGRect thumbnailRect = CGRectZero; 32 | thumbnailRect.origin = CGPointZero; 33 | thumbnailRect.size.width = thumbnailWidth; 34 | thumbnailRect.size.height = thumbnailHeight; 35 | 36 | [sourceImage drawInRect:thumbnailRect]; 37 | 38 | newImage = UIGraphicsGetImageFromCurrentImageContext(); 39 | UIGraphicsEndImageContext(); 40 | return newImage; 41 | } 42 | 43 | + (UIImage *)kr_circularImage:(UIImage *)image withRadius:(CGFloat)radius withDiamter:(NSUInteger)diameter 44 | { 45 | if (!image) { 46 | return nil; 47 | } 48 | CGRect frame = CGRectMake(0.0f, 0.0f, diameter, diameter); 49 | UIImage *newImage = nil; 50 | 51 | UIGraphicsBeginImageContextWithOptions(frame.size, NO, [UIScreen mainScreen].scale); 52 | { 53 | CGContextRef context = UIGraphicsGetCurrentContext(); 54 | CGContextSaveGState(context); 55 | 56 | UIBezierPath *imgPath = [UIBezierPath bezierPathWithRoundedRect:frame cornerRadius:radius]; 57 | [imgPath addClip]; 58 | [image drawInRect:frame]; 59 | 60 | newImage = UIGraphicsGetImageFromCurrentImageContext(); 61 | 62 | CGContextRestoreGState(context); 63 | } 64 | UIGraphicsEndImageContext(); 65 | 66 | return newImage; 67 | } 68 | 69 | + (UIImage *)kr_imageWithColor:(UIColor *)color 70 | { 71 | CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 72 | UIGraphicsBeginImageContext(rect.size); 73 | CGContextRef context = UIGraphicsGetCurrentContext(); 74 | 75 | CGContextSetFillColorWithColor(context, [color CGColor]); 76 | CGContextFillRect(context, rect); 77 | 78 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 79 | UIGraphicsEndImageContext(); 80 | 81 | return image; 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/UIKit/UIImageView+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageView+KRKit.h 3 | // KRKit 4 | // 5 | // Created by 小普 on 15/4/30. 6 | // Copyright (c) 2015年 36kr. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface UIImageView (KRKit) 12 | 13 | - (instancetype)initWithImage:(UIImage *)image tintColor:(UIColor *)tintColor; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/UIKit/UIImageView+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageView+KRKit.m 3 | // KRKit 4 | // 5 | // Created by 小普 on 15/4/30. 6 | // Copyright (c) 2015年 36kr. All rights reserved. 7 | // 8 | 9 | #import "UIImageView+KRKit.h" 10 | 11 | @implementation UIImageView (KRKit) 12 | 13 | - (instancetype)initWithImage:(UIImage *)image tintColor:(UIColor *)tintColor 14 | { 15 | self = [self initWithImage:image]; 16 | if (self) { 17 | self.tintColor = tintColor; 18 | } 19 | return self; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/UIKit/UIView+KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+KRKit.h 3 | // KRKit 4 | // 5 | // Created by 小普 on 15/4/30. 6 | // Copyright (c) 2015年 36kr. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | /************************************************************************************************** 12 | Layout相关 13 | **************************************************************************************************/ 14 | 15 | @interface UIView (KRLayout) 16 | 17 | @property (nonatomic) CGFloat left; 18 | 19 | @property (nonatomic) CGFloat top; 20 | 21 | @property (nonatomic) CGFloat right; 22 | 23 | @property (nonatomic) CGFloat bottom; 24 | 25 | @property (nonatomic) CGFloat width; 26 | 27 | @property (nonatomic) CGFloat height; 28 | 29 | @property (nonatomic) CGFloat centerX; 30 | 31 | @property (nonatomic) CGFloat centerY; 32 | 33 | @property (nonatomic) CGPoint origin; 34 | 35 | @property (nonatomic) CGSize size; 36 | 37 | @property (nonatomic) CGFloat cornerRadius; 38 | 39 | @property (nonatomic) UIView *topSuperView; 40 | 41 | - (void)kr_widthEqualToView:(UIView *)view; 42 | - (void)kr_heightEqualToView:(UIView *)view; 43 | - (void)kr_sizeEqualToView:(UIView *)view; 44 | - (void)kr_centerXEqualToView:(UIView *)view; 45 | - (void)kr_centerYEqualToView:(UIView *)view; 46 | - (void)kr_top:(CGFloat)top fromView:(UIView *)view; 47 | - (void)kr_bottom:(CGFloat)bottom fromView:(UIView *)view; 48 | - (void)kr_left:(CGFloat)left fromView:(UIView *)view; 49 | - (void)kr_right:(CGFloat)right fromView:(UIView *)view; 50 | - (void)kr_fillWidth; 51 | - (void)kr_fillHeight; 52 | - (void)kr_fill; 53 | - (void)kr_removeAllSubviews; 54 | 55 | @end 56 | 57 | @interface UIView (Debug) 58 | 59 | - (void)kr_markBorderWithRandomColor; 60 | - (void)kr_markBorderWithRandomColorRecursive; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Categories/UIKit/UIView+KRKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+KRKit.m 3 | // KRKit 4 | // 5 | // Created by 小普 on 15/4/30. 6 | // Copyright (c) 2015年 36kr. All rights reserved. 7 | // 8 | 9 | #import "UIView+KRKit.h" 10 | #import 11 | @import QuartzCore; 12 | 13 | @implementation UIView (KRLayout) 14 | 15 | - (CGFloat)left 16 | { 17 | return self.frame.origin.x; 18 | } 19 | 20 | - (void)setLeft:(CGFloat)x 21 | { 22 | CGRect frame = self.frame; 23 | frame.origin.x = x; 24 | self.frame = frame; 25 | } 26 | 27 | - (CGFloat)top 28 | { 29 | return self.frame.origin.y; 30 | } 31 | 32 | - (void)setTop:(CGFloat)y 33 | { 34 | CGRect frame = self.frame; 35 | frame.origin.y = y; 36 | self.frame = frame; 37 | } 38 | 39 | - (CGFloat)right 40 | { 41 | return self.frame.origin.x + self.frame.size.width; 42 | } 43 | 44 | - (void)setRight:(CGFloat)right 45 | { 46 | CGRect frame = self.frame; 47 | frame.origin.x = right - frame.size.width; 48 | self.frame = frame; 49 | } 50 | 51 | - (CGFloat)bottom 52 | { 53 | return self.frame.origin.y + self.frame.size.height; 54 | } 55 | 56 | - (void)setBottom:(CGFloat)bottom 57 | { 58 | CGRect frame = self.frame; 59 | frame.origin.y = bottom - frame.size.height; 60 | self.frame = frame; 61 | } 62 | 63 | - (CGFloat)centerX 64 | { 65 | return self.center.x; 66 | } 67 | 68 | - (void)setCenterX:(CGFloat)centerX 69 | { 70 | self.center = CGPointMake(centerX, self.center.y); 71 | } 72 | 73 | - (CGFloat)centerY 74 | { 75 | return self.center.y; 76 | } 77 | 78 | - (void)setCenterY:(CGFloat)centerY 79 | { 80 | self.center = CGPointMake(self.center.x, centerY); 81 | } 82 | 83 | - (CGFloat)width 84 | { 85 | return self.frame.size.width; 86 | } 87 | 88 | - (void)setWidth:(CGFloat)width 89 | { 90 | CGRect frame = self.frame; 91 | frame.size.width = width; 92 | self.frame = frame; 93 | } 94 | 95 | - (CGFloat)height 96 | { 97 | return self.frame.size.height; 98 | } 99 | 100 | - (void)setHeight:(CGFloat)height 101 | { 102 | CGRect frame = self.frame; 103 | frame.size.height = height; 104 | self.frame = frame; 105 | } 106 | 107 | - (CGPoint)origin 108 | { 109 | return self.frame.origin; 110 | } 111 | 112 | - (void)setOrigin:(CGPoint)origin 113 | { 114 | CGRect frame = self.frame; 115 | frame.origin = origin; 116 | self.frame = frame; 117 | } 118 | 119 | - (CGSize)size 120 | { 121 | return self.frame.size; 122 | } 123 | 124 | - (void)setSize:(CGSize)size 125 | { 126 | CGRect frame = self.frame; 127 | frame.size = size; 128 | self.frame = frame; 129 | } 130 | 131 | - (void)setCornerRadius:(CGFloat)cornerRadius 132 | { 133 | self.layer.cornerRadius = cornerRadius; 134 | self.layer.masksToBounds = YES; 135 | } 136 | 137 | - (CGFloat)cornerRadius 138 | { 139 | return self.layer.cornerRadius; 140 | } 141 | 142 | - (UIView *)topSuperView 143 | { 144 | UIView *topSuperView = self.superview; 145 | 146 | if (topSuperView == nil) { 147 | topSuperView = self; 148 | } else { 149 | while (topSuperView.superview) { 150 | topSuperView = topSuperView.superview; 151 | } 152 | } 153 | 154 | return topSuperView; 155 | } 156 | 157 | - (void)setTopSuperView:(UIView *)topSuperView 158 | { 159 | 160 | } 161 | 162 | - (void)kr_widthEqualToView:(UIView *)view 163 | { 164 | self.width = view.width; 165 | } 166 | 167 | - (void)kr_heightEqualToView:(UIView *)view 168 | { 169 | self.height = view.height; 170 | } 171 | 172 | - (void)kr_sizeEqualToView:(UIView *)view 173 | { 174 | self.size = view.size; 175 | } 176 | 177 | - (void)kr_centerXEqualToView:(UIView *)view 178 | { 179 | UIView *superView = view.superview ? view.superview : view; 180 | CGPoint viewCenterPoint = [superView convertPoint:view.center toView:self.topSuperView]; 181 | CGPoint centerPoint = [self.topSuperView convertPoint:viewCenterPoint toView:self.superview]; 182 | self.centerX = centerPoint.x; 183 | } 184 | 185 | - (void)kr_centerYEqualToView:(UIView *)view 186 | { 187 | UIView *superView = view.superview ? view.superview : view; 188 | CGPoint viewCenterPoint = [superView convertPoint:view.center toView:self.topSuperView]; 189 | CGPoint centerPoint = [self.topSuperView convertPoint:viewCenterPoint toView:self.superview]; 190 | self.centerY = centerPoint.y; 191 | } 192 | 193 | - (void)kr_top:(CGFloat)top fromView:(UIView *)view 194 | { 195 | UIView *superView = view.superview ? view.superview : view; 196 | CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView]; 197 | CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview]; 198 | 199 | self.top = newOrigin.y + top + view.height; 200 | } 201 | 202 | - (void)kr_bottom:(CGFloat)bottom fromView:(UIView *)view 203 | { 204 | UIView *superView = view.superview ? view.superview : view; 205 | CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView]; 206 | CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview]; 207 | 208 | self.top = newOrigin.y - bottom - self.height; 209 | } 210 | 211 | - (void)kr_left:(CGFloat)left fromView:(UIView *)view 212 | { 213 | UIView *superView = view.superview ? view.superview : view; 214 | CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView]; 215 | CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview]; 216 | 217 | self.left = newOrigin.x - left - self.width; 218 | } 219 | 220 | - (void)kr_right:(CGFloat)right fromView:(UIView *)view 221 | { 222 | UIView *superView = view.superview ? view.superview : view; 223 | CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView]; 224 | CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview]; 225 | 226 | self.left = newOrigin.x + right + view.width; 227 | } 228 | 229 | - (void)kr_fillWidth 230 | { 231 | self.frame = CGRectMake(0, self.top, self.superview.width, self.height); 232 | } 233 | 234 | - (void)kr_fillHeight 235 | { 236 | self.frame = CGRectMake(self.left, 0, self.width, self.superview.height); 237 | } 238 | 239 | - (void)kr_fill 240 | { 241 | self.frame = CGRectMake(0, 0, self.superview.width, self.superview.height); 242 | } 243 | 244 | - (void)kr_removeAllSubviews 245 | { 246 | while (self.subviews.count) { 247 | UIView* child = self.subviews.lastObject; 248 | [child removeFromSuperview]; 249 | } 250 | } 251 | 252 | @end 253 | 254 | @implementation UIView (Debug) 255 | 256 | - (void)kr_markBorderWithRandomColor 257 | { 258 | self.layer.borderColor = [UIColor colorWithRed:(arc4random() % 255 )/ 255.f green:(arc4random() % 255 )/ 255.f blue:(arc4random() % 255 )/ 255.f alpha:1].CGColor; 259 | self.layer.borderWidth = 1.0f; 260 | } 261 | 262 | - (void)kr_markBorderWithRandomColorRecursive 263 | { 264 | [self kr_markBorderWithRandomColor]; 265 | for (UIView *v in self.subviews) { 266 | [v kr_markBorderWithRandomColorRecursive]; 267 | } 268 | } 269 | 270 | @end -------------------------------------------------------------------------------- /KRKit/KRKit/Source/KRKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // KRKit.h 3 | // KRKit 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for KRKit. 12 | FOUNDATION_EXPORT double KRKitVersionNumber; 13 | 14 | //! Project version string for KRKit. 15 | FOUNDATION_EXPORT const unsigned char KRKitVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | #import "KRMacro.h" 19 | 20 | #import "NSObject+KRKit.h" 21 | #import "NSArray+KRKit.h" 22 | #import "NSMutableArray+KRKit.h" 23 | #import "NSDictionary+KRKit.h" 24 | #import "NSMutableDictionary+KRKit.h" 25 | #import "NSString+KRKit.h" 26 | #import "NSMutableString+KRKit.h" 27 | #import "NSAttributedString+KRKit.h" 28 | 29 | //UIKit Category 30 | #import "UIView+KRKit.h" 31 | #import "UIImage+KRKit.h" 32 | #import "UIImageView+KRKit.h" 33 | #import "UIColor+KRKit.h" 34 | 35 | //UI Component 36 | #import "KRImageLabelView.h" 37 | 38 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/Macro/KRMacro.h: -------------------------------------------------------------------------------- 1 | // 2 | // KRMacro.m 3 | // KRKit 4 | // 5 | // Created by aidenluo on 5/7/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | /** 10 | * UI相关 11 | */ 12 | #define KRScreenWidth ([[UIScreen mainScreen]bounds].size.width) 13 | #define KRScreenHeight ([[UIScreen mainScreen]bounds].size.height) 14 | #define KRScreenBounds ([[UIScreen mainScreen] bounds]) 15 | #define KRStatusBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height) 16 | #define KROnePixelHeight (1.0/[[UIScreen mainScreen] scale]) 17 | #define KRScreenScale ([[UIScreen mainScreen] scale]) 18 | #define KRNavigationBarHeight 44.0 19 | #define KRTabBarHeight 49.0 20 | 21 | /** 22 | * Device相关 23 | */ 24 | #define KRSystemVersionGreaterThan(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) 25 | #define KRSystemVersionEqualTo(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) 26 | #define KRSystemVersionLessThan(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) 27 | 28 | /** 29 | * Log相关 30 | */ 31 | #define KRLog(s, ...) NSLog( @"[%@ %@] %@",NSStringFromClass([self class]), NSStringFromSelector(_cmd),[NSString stringWithFormat:(s), ##__VA_ARGS__] ) 32 | 33 | /** 34 | * 路径相关 35 | */ 36 | #define KRUserDocumentDirectoryPath ([NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]) 37 | #define KRUserCacheDirectoryPath ([NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]) 38 | 39 | #define KRAppVersion ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]) 40 | #define KRAppBuildNumber ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]) 41 | #define KRAppIdentifier ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]) 42 | #define KRAppDisplayName ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]) 43 | #define KRAppBundleName ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]) -------------------------------------------------------------------------------- /KRKit/KRKit/Source/UI Component/KRImageLabelView.h: -------------------------------------------------------------------------------- 1 | // 2 | // KRIconLabelView.h 3 | // KRClient 4 | // 5 | // Created by aidenluo on 5/9/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, KRImagePosition) 12 | { 13 | KRImagePositionTop, 14 | KRImagePositionLeft, 15 | KRImagePositionBottom, 16 | KRImagePositionRight 17 | }; 18 | 19 | @interface KRImageLabelView : UIView 20 | 21 | @property (nonatomic, assign) KRImagePosition imagePosition; //default is KRImagePositionLeft 22 | @property (nonatomic, assign) CGFloat elementInset; //defaut is 5.0 23 | @property (nonatomic, strong) UIFont *font; 24 | @property (nonatomic, strong) UIColor *textColor; 25 | @property (nonatomic, strong) UIImage *icon; 26 | @property (nonatomic, strong) NSString *text; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /KRKit/KRKit/Source/UI Component/KRImageLabelView.m: -------------------------------------------------------------------------------- 1 | // 2 | // KRIconLabelView.m 3 | // KRClient 4 | // 5 | // Created by aidenluo on 5/9/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import "KRImageLabelView.h" 10 | #import "UIView+KRKit.h" 11 | 12 | @interface KRImageLabelView () 13 | 14 | @property (nonatomic, strong) UIImageView *imageView; 15 | @property (nonatomic, strong) UILabel *label; 16 | 17 | @end 18 | 19 | @implementation KRImageLabelView 20 | 21 | #pragma mark - Override Method 22 | 23 | - (instancetype)init 24 | { 25 | self = [super init]; 26 | if (self) { 27 | [self commonInit]; 28 | } 29 | return self; 30 | } 31 | 32 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 33 | { 34 | self = [super initWithCoder:aDecoder]; 35 | if (self) { 36 | [self commonInit]; 37 | } 38 | return self; 39 | } 40 | 41 | - (instancetype)initWithFrame:(CGRect)frame 42 | { 43 | self = [super initWithFrame:frame]; 44 | if (self) { 45 | [self commonInit]; 46 | } 47 | return self; 48 | } 49 | 50 | - (void)layoutSubviews 51 | { 52 | [super layoutSubviews]; 53 | [self.imageView sizeToFit]; 54 | [self.label sizeToFit]; 55 | switch (self.imagePosition) { 56 | case KRImagePositionTop: 57 | { 58 | CGFloat maxWidth = MAX(self.imageView.width, self.label.width); 59 | self.imageView.top = 0.0; 60 | self.imageView.centerX = maxWidth/2.0; 61 | self.label.top = self.imageView.bottom + self.elementInset; 62 | self.label.centerX = self.imageView.centerX; 63 | self.size = CGSizeMake(maxWidth, self.label.bottom); 64 | break; 65 | } 66 | case KRImagePositionLeft: 67 | { 68 | CGFloat maxHeight = MAX(self.imageView.height, self.label.height); 69 | self.imageView.left = 0.0; 70 | self.imageView.centerY = maxHeight/2.0; 71 | self.label.left = self.imageView.right + self.elementInset; 72 | self.label.centerY = self.imageView.centerY; 73 | self.size = CGSizeMake(self.label.right, maxHeight); 74 | break; 75 | } 76 | case KRImagePositionBottom: 77 | { 78 | CGFloat maxWidth = MAX(self.imageView.width, self.label.width); 79 | self.label.top = 0.0; 80 | self.label.centerX = maxWidth/2.0; 81 | self.imageView.top = self.label.bottom + self.elementInset; 82 | self.imageView.centerX = self.label.centerX; 83 | self.size = CGSizeMake(maxWidth, self.imageView.bottom); 84 | break; 85 | } 86 | case KRImagePositionRight: 87 | { 88 | CGFloat maxHeight = MAX(self.imageView.height, self.label.height); 89 | self.label.left = 0.0; 90 | self.label.centerY = maxHeight/2.0; 91 | self.imageView.left = self.label.right + self.elementInset; 92 | self.imageView.centerY = self.label.centerY; 93 | self.size = CGSizeMake(self.imageView.right, maxHeight); 94 | break; 95 | } 96 | default: 97 | break; 98 | } 99 | } 100 | 101 | #pragma mark - Helper Method 102 | 103 | - (void)commonInit 104 | { 105 | _imagePosition = KRImagePositionLeft; 106 | _elementInset = 5.0; 107 | _font = [UIFont systemFontOfSize:12.0]; 108 | _textColor = [UIColor grayColor]; 109 | _imageView = [UIImageView new]; 110 | _label = [UILabel new]; 111 | _label.backgroundColor = [UIColor clearColor]; 112 | _label.textColor = _textColor; 113 | [self addSubview:_label]; 114 | [self addSubview:_imageView]; 115 | } 116 | 117 | #pragma mark - Property Method 118 | 119 | - (void)setImagePosition:(KRImagePosition)imagePosition 120 | { 121 | if (_imagePosition != imagePosition) { 122 | _imagePosition = imagePosition; 123 | [self setNeedsLayout]; 124 | [self layoutIfNeeded]; 125 | } 126 | } 127 | 128 | - (void)setFont:(UIFont *)font 129 | { 130 | if (_font != font) { 131 | _font = font; 132 | self.label.font = font; 133 | [self setNeedsLayout]; 134 | [self layoutIfNeeded]; 135 | } 136 | } 137 | 138 | - (void)setElementInset:(CGFloat)elementInset 139 | { 140 | if (_elementInset != elementInset) { 141 | _elementInset = elementInset; 142 | [self setNeedsLayout]; 143 | [self layoutIfNeeded]; 144 | } 145 | } 146 | 147 | - (void)setTextColor:(UIColor *)textColor 148 | { 149 | if (_textColor != textColor) { 150 | _textColor = textColor; 151 | self.label.textColor = textColor; 152 | [self.label setNeedsDisplay]; 153 | } 154 | } 155 | 156 | - (void)setIcon:(UIImage *)icon 157 | { 158 | if (_icon != icon) { 159 | _icon = icon; 160 | self.imageView.image = _icon; 161 | [self setNeedsLayout]; 162 | [self layoutIfNeeded]; 163 | } 164 | } 165 | 166 | - (void)setText:(NSString *)text 167 | { 168 | if (_text != text) { 169 | _text = text; 170 | self.label.text = text; 171 | [self setNeedsLayout]; 172 | [self layoutIfNeeded]; 173 | } 174 | } 175 | 176 | @end 177 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // KRKitDemo 4 | // 5 | // Created by aidenluo on 5/23/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // KRKitDemo 4 | // 5 | // Created by aidenluo on 5/23/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | 21 | NSLog(@"%@ %@ %@ %@ %@",KRAppVersion,KRAppBuildNumber,KRAppIdentifier,KRAppDisplayName,KRAppBundleName); 22 | 23 | return YES; 24 | } 25 | 26 | - (void)applicationWillResignActive:(UIApplication *)application { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 29 | } 30 | 31 | - (void)applicationDidEnterBackground:(UIApplication *)application { 32 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | - (void)applicationDidBecomeActive:(UIApplication *)application { 41 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 42 | } 43 | 44 | - (void)applicationWillTerminate:(UIApplication *)application { 45 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/FirstViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.h 3 | // KRKitDemo 4 | // 5 | // Created by aidenluo on 5/23/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FirstViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/FirstViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.m 3 | // KRKitDemo 4 | // 5 | // Created by aidenluo on 5/23/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import "FirstViewController.h" 10 | 11 | @interface FirstViewController () 12 | 13 | @end 14 | 15 | @implementation FirstViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | KRImageLabelView *view = [KRImageLabelView new]; 21 | view.text = @"hello"; 22 | [view kr_markBorderWithRandomColor]; 23 | [self.view addSubview:view]; 24 | view.center = self.view.center; 25 | } 26 | 27 | - (void)didReceiveMemoryWarning { 28 | [super didReceiveMemoryWarning]; 29 | // Dispose of any resources that can be recreated. 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /KRKit/KRKitDemo/Images.xcassets/first.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "first.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /KRKit/KRKitDemo/Images.xcassets/first.imageset/first.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/36Kr-Mobile/KRKit/9e38e05f81caccbb7c6c6e515b1b7b231ee4fca8/KRKit/KRKitDemo/Images.xcassets/first.imageset/first.pdf -------------------------------------------------------------------------------- /KRKit/KRKitDemo/Images.xcassets/second.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "second.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /KRKit/KRKitDemo/Images.xcassets/second.imageset/second.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/36Kr-Mobile/KRKit/9e38e05f81caccbb7c6c6e515b1b7b231ee4fca8/KRKit/KRKitDemo/Images.xcassets/second.imageset/second.pdf -------------------------------------------------------------------------------- /KRKit/KRKitDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.36kr.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarTintParameters 34 | 35 | UINavigationBar 36 | 37 | Style 38 | UIBarStyleDefault 39 | Translucent 40 | 41 | 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | UISupportedInterfaceOrientations~ipad 50 | 51 | UIInterfaceOrientationPortrait 52 | UIInterfaceOrientationPortraitUpsideDown 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/KRKitDemo-prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // KRClient.pch 3 | // KRClient 4 | // 5 | // Created by aidenluo on 3/8/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #ifndef __IPHONE_7_0 12 | #warning "This project uses features only available in iOS SDK 7.0 and later." 13 | #endif 14 | 15 | #ifdef __OBJC__ 16 | #import 17 | #import 18 | #endif 19 | 20 | #import "KRKit.h" 21 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/SecondViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.h 3 | // KRKitDemo 4 | // 5 | // Created by aidenluo on 5/23/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SecondViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/SecondViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.m 3 | // KRKitDemo 4 | // 5 | // Created by aidenluo on 5/23/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import "SecondViewController.h" 10 | 11 | @interface SecondViewController () 12 | 13 | @end 14 | 15 | @implementation SecondViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /KRKit/KRKitDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // KRKitDemo 4 | // 5 | // Created by aidenluo on 5/23/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KRKit/KRKitDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.36kr.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /KRKit/KRKitDemoTests/KRKitDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // KRKitDemoTests.m 3 | // KRKitDemoTests 4 | // 5 | // Created by aidenluo on 5/23/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface KRKitDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation KRKitDemoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /KRKit/KRKitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.36kr.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /KRKit/KRKitTests/KRKitTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // KRKitTests.m 3 | // KRKitTests 4 | // 5 | // Created by aidenluo on 4/30/15. 6 | // Copyright (c) 2015 36kr. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "KRKit.h" 12 | 13 | @interface KRKitTests : XCTestCase 14 | 15 | @end 16 | 17 | @implementation KRKitTests 18 | 19 | - (void)setUp { 20 | [super setUp]; 21 | // Put setup code here. This method is called before the invocation of each test method in the class. 22 | } 23 | 24 | - (void)tearDown { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testNSArray 30 | { 31 | NSArray *array = @[@(1),@(2)]; 32 | XCTAssertEqualObjects([array kr_objectAtIndex:0], @(1)); 33 | XCTAssertNil([array kr_objectAtIndex:2]); 34 | } 35 | 36 | - (void)testNSString 37 | { 38 | NSString *str = @"http://www.baidu.com"; 39 | NSLog(@"%@",[str kr_md5]); 40 | XCTAssertNotNil([str kr_md5]); 41 | NSLog(@"%@",[str kr_convertToURL]); 42 | XCTAssertTrue([[str kr_convertToURL] isKindOfClass:[NSURL class]]); 43 | NSString *email = @"hello@"; 44 | XCTAssertFalse([email kr_isEmail]); 45 | email = @"hello@gmail.com"; 46 | XCTAssertTrue([email kr_isEmail]); 47 | NSString *emptyStr = nil; 48 | XCTAssertFalse([emptyStr kr_isNotEmpty]); 49 | emptyStr = @" "; 50 | XCTAssertFalse([emptyStr kr_isNotEmpty]); 51 | emptyStr = @" akh "; 52 | XCTAssertTrue([emptyStr kr_isNotEmpty]); 53 | NSString *originStr = @"alkjdlkajafldjkf"; 54 | NSString *base64 = [originStr kr_encodeBase64]; 55 | NSString *decode64 = [base64 kr_decodeBase64]; 56 | NSLog(@"%@ %@",base64, decode64); 57 | XCTAssertTrue([originStr isEqualToString:decode64]); 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 aidenluo 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KRKit 2 | 3 | ## Usage 4 | 5 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 6 | 7 | ## Requirements 8 | 9 | iOS 7.0 and later 10 | 11 | ## Installation 12 | 13 | KRKit is available through [CocoaPods](http://cocoapods.org). To install 14 | it, simply add the following line to your Podfile: 15 | 16 | ```ruby 17 | pod "KRKit", :git => 'https://github.com/36Kr-Mobile/KRKit.git' 18 | ``` 19 | 20 | ## Author 21 | 22 | aidenluo, aidenluo177@gmail.com 23 | 24 | ## License 25 | 26 | KRKit is available under the MIT license. See the LICENSE file for more info. 27 | --------------------------------------------------------------------------------