├── .gitignore ├── LBXScanUITool.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── LBXScanUITool ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── 20170509051036256_64.png │ │ ├── 20170509051221166_256-1.png │ │ ├── 20170509051221166_256.png │ │ └── Contents.json │ ├── Contents.json │ ├── backImg.imageset │ │ ├── 11111.jpg │ │ └── Contents.json │ ├── device_scan.imageset │ │ ├── Contents.json │ │ └── device_scan@2x.png │ ├── qrcode_Scan_weixin_Line.imageset │ │ ├── Contents.json │ │ └── qrcode_Scan_weixin_Line@2x.png │ ├── qrcode_scan_btn_flash_down.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_btn_flash_down@2x.png │ ├── qrcode_scan_btn_flash_nor.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_btn_flash_nor@2x.png │ ├── qrcode_scan_btn_myqrcode_down.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_btn_myqrcode_down@2x.png │ ├── qrcode_scan_btn_myqrcode_nor.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_btn_myqrcode_nor@2x.png │ ├── qrcode_scan_btn_photo_down.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_btn_photo_down@2x.png │ ├── qrcode_scan_btn_photo_nor.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_btn_photo_nor@2x.png │ ├── qrcode_scan_btn_scan_off.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_btn_scan_off@2x.png │ ├── qrcode_scan_full_net.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_full_net.png │ ├── qrcode_scan_light_green.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_light_green@2x.png │ ├── qrcode_scan_part_net.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_part_net.png │ ├── qrcode_scan_titlebar_back_nor.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_titlebar_back_nor@2x.png │ └── qrcode_scan_titlebar_back_pressed.imageset │ │ ├── Contents.json │ │ └── qrcode_scan_titlebar_back_pressed@2x.png ├── Base.lproj │ └── Main.storyboard ├── ClearTextField.h ├── ClearTextField.m ├── FlippedView.h ├── FlippedView.m ├── Info.plist ├── UI │ ├── CodeScan.bundle │ │ ├── device_scan@2x.png │ │ ├── qrcode_Scan_weixin_Line@2x.png │ │ ├── qrcode_scan_btn_flash_down@2x.png │ │ ├── qrcode_scan_btn_flash_nor@2x.png │ │ ├── qrcode_scan_btn_myqrcode_down@2x.png │ │ ├── qrcode_scan_btn_myqrcode_nor@2x.png │ │ ├── qrcode_scan_btn_photo_down@2x.png │ │ ├── qrcode_scan_btn_photo_nor@2x.png │ │ ├── qrcode_scan_btn_scan_off@2x.png │ │ ├── qrcode_scan_full_net.png │ │ ├── qrcode_scan_light_green@2x.png │ │ ├── qrcode_scan_part_net.png │ │ ├── qrcode_scan_titlebar_back_nor@2x.png │ │ └── qrcode_scan_titlebar_back_pressed@2x.png │ ├── LBXScanLineAnimation.h │ ├── LBXScanLineAnimation.m │ ├── LBXScanNetAnimation.h │ ├── LBXScanNetAnimation.m │ ├── LBXScanView.h │ ├── LBXScanView.m │ ├── LBXScanViewStyle.h │ ├── LBXScanViewStyle.m │ ├── NSView+Extension.h │ └── NSView+Extension.m ├── ViewController.h ├── ViewController.m └── main.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /LBXScanUITool.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 733D94411EEF8B59006EC2C7 /* FlippedView.m in Sources */ = {isa = PBXBuildFile; fileRef = 733D94401EEF8B59006EC2C7 /* FlippedView.m */; }; 11 | 73731A551EEE33D9008EFEA4 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 73731A541EEE33D9008EFEA4 /* AppDelegate.m */; }; 12 | 73731A581EEE33D9008EFEA4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 73731A571EEE33D9008EFEA4 /* main.m */; }; 13 | 73731A5B1EEE33D9008EFEA4 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 73731A5A1EEE33D9008EFEA4 /* ViewController.m */; }; 14 | 73731A5D1EEE33D9008EFEA4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 73731A5C1EEE33D9008EFEA4 /* Assets.xcassets */; }; 15 | 73731A601EEE33D9008EFEA4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 73731A5E1EEE33D9008EFEA4 /* Main.storyboard */; }; 16 | 73731A761EEE3508008EFEA4 /* LBXScanLineAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 73731A6A1EEE3508008EFEA4 /* LBXScanLineAnimation.m */; }; 17 | 73731A771EEE3508008EFEA4 /* LBXScanNetAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 73731A6C1EEE3508008EFEA4 /* LBXScanNetAnimation.m */; }; 18 | 73731A791EEE3508008EFEA4 /* LBXScanView.m in Sources */ = {isa = PBXBuildFile; fileRef = 73731A701EEE3508008EFEA4 /* LBXScanView.m */; }; 19 | 73731A7B1EEE3508008EFEA4 /* LBXScanViewStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 73731A741EEE3508008EFEA4 /* LBXScanViewStyle.m */; }; 20 | 73731A7E1EEE36D4008EFEA4 /* NSView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 73731A7D1EEE36D4008EFEA4 /* NSView+Extension.m */; }; 21 | 7388B58D1EF3B9E70075FFFA /* ClearTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 7388B58C1EF3B9E70075FFFA /* ClearTextField.m */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 733D943F1EEF8B59006EC2C7 /* FlippedView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlippedView.h; sourceTree = ""; }; 26 | 733D94401EEF8B59006EC2C7 /* FlippedView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlippedView.m; sourceTree = ""; }; 27 | 73731A501EEE33D9008EFEA4 /* LBXScanUITool.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LBXScanUITool.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 73731A531EEE33D9008EFEA4 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 29 | 73731A541EEE33D9008EFEA4 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 30 | 73731A571EEE33D9008EFEA4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 31 | 73731A591EEE33D9008EFEA4 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 32 | 73731A5A1EEE33D9008EFEA4 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 33 | 73731A5C1EEE33D9008EFEA4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 34 | 73731A5F1EEE33D9008EFEA4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | 73731A611EEE33D9008EFEA4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 73731A691EEE3508008EFEA4 /* LBXScanLineAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBXScanLineAnimation.h; sourceTree = ""; }; 37 | 73731A6A1EEE3508008EFEA4 /* LBXScanLineAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBXScanLineAnimation.m; sourceTree = ""; }; 38 | 73731A6B1EEE3508008EFEA4 /* LBXScanNetAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBXScanNetAnimation.h; sourceTree = ""; }; 39 | 73731A6C1EEE3508008EFEA4 /* LBXScanNetAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBXScanNetAnimation.m; sourceTree = ""; }; 40 | 73731A6F1EEE3508008EFEA4 /* LBXScanView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBXScanView.h; sourceTree = ""; }; 41 | 73731A701EEE3508008EFEA4 /* LBXScanView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBXScanView.m; sourceTree = ""; }; 42 | 73731A731EEE3508008EFEA4 /* LBXScanViewStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBXScanViewStyle.h; sourceTree = ""; }; 43 | 73731A741EEE3508008EFEA4 /* LBXScanViewStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBXScanViewStyle.m; sourceTree = ""; }; 44 | 73731A7C1EEE36D4008EFEA4 /* NSView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSView+Extension.h"; sourceTree = ""; }; 45 | 73731A7D1EEE36D4008EFEA4 /* NSView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSView+Extension.m"; sourceTree = ""; }; 46 | 7388B58B1EF3B9E70075FFFA /* ClearTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClearTextField.h; sourceTree = ""; }; 47 | 7388B58C1EF3B9E70075FFFA /* ClearTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClearTextField.m; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | 73731A4D1EEE33D9008EFEA4 /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 73731A471EEE33D9008EFEA4 = { 62 | isa = PBXGroup; 63 | children = ( 64 | 73731A521EEE33D9008EFEA4 /* LBXScanUITool */, 65 | 73731A511EEE33D9008EFEA4 /* Products */, 66 | ); 67 | sourceTree = ""; 68 | }; 69 | 73731A511EEE33D9008EFEA4 /* Products */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 73731A501EEE33D9008EFEA4 /* LBXScanUITool.app */, 73 | ); 74 | name = Products; 75 | sourceTree = ""; 76 | }; 77 | 73731A521EEE33D9008EFEA4 /* LBXScanUITool */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 73731A671EEE3508008EFEA4 /* UI */, 81 | 73731A531EEE33D9008EFEA4 /* AppDelegate.h */, 82 | 73731A541EEE33D9008EFEA4 /* AppDelegate.m */, 83 | 73731A591EEE33D9008EFEA4 /* ViewController.h */, 84 | 73731A5A1EEE33D9008EFEA4 /* ViewController.m */, 85 | 73731A5C1EEE33D9008EFEA4 /* Assets.xcassets */, 86 | 73731A5E1EEE33D9008EFEA4 /* Main.storyboard */, 87 | 73731A611EEE33D9008EFEA4 /* Info.plist */, 88 | 73731A561EEE33D9008EFEA4 /* Supporting Files */, 89 | 733D943F1EEF8B59006EC2C7 /* FlippedView.h */, 90 | 733D94401EEF8B59006EC2C7 /* FlippedView.m */, 91 | 7388B58B1EF3B9E70075FFFA /* ClearTextField.h */, 92 | 7388B58C1EF3B9E70075FFFA /* ClearTextField.m */, 93 | ); 94 | path = LBXScanUITool; 95 | sourceTree = ""; 96 | }; 97 | 73731A561EEE33D9008EFEA4 /* Supporting Files */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 73731A571EEE33D9008EFEA4 /* main.m */, 101 | ); 102 | name = "Supporting Files"; 103 | sourceTree = ""; 104 | }; 105 | 73731A671EEE3508008EFEA4 /* UI */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 73731A691EEE3508008EFEA4 /* LBXScanLineAnimation.h */, 109 | 73731A6A1EEE3508008EFEA4 /* LBXScanLineAnimation.m */, 110 | 73731A6B1EEE3508008EFEA4 /* LBXScanNetAnimation.h */, 111 | 73731A6C1EEE3508008EFEA4 /* LBXScanNetAnimation.m */, 112 | 73731A6F1EEE3508008EFEA4 /* LBXScanView.h */, 113 | 73731A701EEE3508008EFEA4 /* LBXScanView.m */, 114 | 73731A731EEE3508008EFEA4 /* LBXScanViewStyle.h */, 115 | 73731A741EEE3508008EFEA4 /* LBXScanViewStyle.m */, 116 | 73731A7C1EEE36D4008EFEA4 /* NSView+Extension.h */, 117 | 73731A7D1EEE36D4008EFEA4 /* NSView+Extension.m */, 118 | ); 119 | path = UI; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 73731A4F1EEE33D9008EFEA4 /* LBXScanUITool */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 73731A641EEE33D9008EFEA4 /* Build configuration list for PBXNativeTarget "LBXScanUITool" */; 128 | buildPhases = ( 129 | 73731A4C1EEE33D9008EFEA4 /* Sources */, 130 | 73731A4D1EEE33D9008EFEA4 /* Frameworks */, 131 | 73731A4E1EEE33D9008EFEA4 /* Resources */, 132 | ); 133 | buildRules = ( 134 | ); 135 | dependencies = ( 136 | ); 137 | name = LBXScanUITool; 138 | productName = LBXScanUITool; 139 | productReference = 73731A501EEE33D9008EFEA4 /* LBXScanUITool.app */; 140 | productType = "com.apple.product-type.application"; 141 | }; 142 | /* End PBXNativeTarget section */ 143 | 144 | /* Begin PBXProject section */ 145 | 73731A481EEE33D9008EFEA4 /* Project object */ = { 146 | isa = PBXProject; 147 | attributes = { 148 | LastUpgradeCheck = 0830; 149 | ORGANIZATIONNAME = lbx; 150 | TargetAttributes = { 151 | 73731A4F1EEE33D9008EFEA4 = { 152 | CreatedOnToolsVersion = 8.3.2; 153 | DevelopmentTeam = 8LQ7CL73D8; 154 | ProvisioningStyle = Automatic; 155 | }; 156 | }; 157 | }; 158 | buildConfigurationList = 73731A4B1EEE33D9008EFEA4 /* Build configuration list for PBXProject "LBXScanUITool" */; 159 | compatibilityVersion = "Xcode 3.2"; 160 | developmentRegion = English; 161 | hasScannedForEncodings = 0; 162 | knownRegions = ( 163 | en, 164 | Base, 165 | ); 166 | mainGroup = 73731A471EEE33D9008EFEA4; 167 | productRefGroup = 73731A511EEE33D9008EFEA4 /* Products */; 168 | projectDirPath = ""; 169 | projectRoot = ""; 170 | targets = ( 171 | 73731A4F1EEE33D9008EFEA4 /* LBXScanUITool */, 172 | ); 173 | }; 174 | /* End PBXProject section */ 175 | 176 | /* Begin PBXResourcesBuildPhase section */ 177 | 73731A4E1EEE33D9008EFEA4 /* Resources */ = { 178 | isa = PBXResourcesBuildPhase; 179 | buildActionMask = 2147483647; 180 | files = ( 181 | 73731A5D1EEE33D9008EFEA4 /* Assets.xcassets in Resources */, 182 | 73731A601EEE33D9008EFEA4 /* Main.storyboard in Resources */, 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | }; 186 | /* End PBXResourcesBuildPhase section */ 187 | 188 | /* Begin PBXSourcesBuildPhase section */ 189 | 73731A4C1EEE33D9008EFEA4 /* Sources */ = { 190 | isa = PBXSourcesBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | 73731A771EEE3508008EFEA4 /* LBXScanNetAnimation.m in Sources */, 194 | 7388B58D1EF3B9E70075FFFA /* ClearTextField.m in Sources */, 195 | 73731A761EEE3508008EFEA4 /* LBXScanLineAnimation.m in Sources */, 196 | 73731A7B1EEE3508008EFEA4 /* LBXScanViewStyle.m in Sources */, 197 | 73731A5B1EEE33D9008EFEA4 /* ViewController.m in Sources */, 198 | 73731A791EEE3508008EFEA4 /* LBXScanView.m in Sources */, 199 | 73731A581EEE33D9008EFEA4 /* main.m in Sources */, 200 | 73731A551EEE33D9008EFEA4 /* AppDelegate.m in Sources */, 201 | 733D94411EEF8B59006EC2C7 /* FlippedView.m in Sources */, 202 | 73731A7E1EEE36D4008EFEA4 /* NSView+Extension.m in Sources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | /* End PBXSourcesBuildPhase section */ 207 | 208 | /* Begin PBXVariantGroup section */ 209 | 73731A5E1EEE33D9008EFEA4 /* Main.storyboard */ = { 210 | isa = PBXVariantGroup; 211 | children = ( 212 | 73731A5F1EEE33D9008EFEA4 /* Base */, 213 | ); 214 | name = Main.storyboard; 215 | sourceTree = ""; 216 | }; 217 | /* End PBXVariantGroup section */ 218 | 219 | /* Begin XCBuildConfiguration section */ 220 | 73731A621EEE33D9008EFEA4 /* Debug */ = { 221 | isa = XCBuildConfiguration; 222 | buildSettings = { 223 | ALWAYS_SEARCH_USER_PATHS = NO; 224 | CLANG_ANALYZER_NONNULL = YES; 225 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 226 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 227 | CLANG_CXX_LIBRARY = "libc++"; 228 | CLANG_ENABLE_MODULES = YES; 229 | CLANG_ENABLE_OBJC_ARC = YES; 230 | CLANG_WARN_BOOL_CONVERSION = YES; 231 | CLANG_WARN_CONSTANT_CONVERSION = YES; 232 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 233 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 234 | CLANG_WARN_EMPTY_BODY = YES; 235 | CLANG_WARN_ENUM_CONVERSION = YES; 236 | CLANG_WARN_INFINITE_RECURSION = YES; 237 | CLANG_WARN_INT_CONVERSION = YES; 238 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 239 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 240 | CLANG_WARN_UNREACHABLE_CODE = YES; 241 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 242 | CODE_SIGN_IDENTITY = "-"; 243 | COPY_PHASE_STRIP = NO; 244 | DEBUG_INFORMATION_FORMAT = dwarf; 245 | ENABLE_STRICT_OBJC_MSGSEND = YES; 246 | ENABLE_TESTABILITY = YES; 247 | GCC_C_LANGUAGE_STANDARD = gnu99; 248 | GCC_DYNAMIC_NO_PIC = NO; 249 | GCC_NO_COMMON_BLOCKS = YES; 250 | GCC_OPTIMIZATION_LEVEL = 0; 251 | GCC_PREPROCESSOR_DEFINITIONS = ( 252 | "DEBUG=1", 253 | "$(inherited)", 254 | ); 255 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 256 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 257 | GCC_WARN_UNDECLARED_SELECTOR = YES; 258 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 259 | GCC_WARN_UNUSED_FUNCTION = YES; 260 | GCC_WARN_UNUSED_VARIABLE = YES; 261 | MACOSX_DEPLOYMENT_TARGET = 10.12; 262 | MTL_ENABLE_DEBUG_INFO = YES; 263 | ONLY_ACTIVE_ARCH = YES; 264 | SDKROOT = macosx; 265 | }; 266 | name = Debug; 267 | }; 268 | 73731A631EEE33D9008EFEA4 /* Release */ = { 269 | isa = XCBuildConfiguration; 270 | buildSettings = { 271 | ALWAYS_SEARCH_USER_PATHS = NO; 272 | CLANG_ANALYZER_NONNULL = YES; 273 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 274 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 275 | CLANG_CXX_LIBRARY = "libc++"; 276 | CLANG_ENABLE_MODULES = YES; 277 | CLANG_ENABLE_OBJC_ARC = YES; 278 | CLANG_WARN_BOOL_CONVERSION = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 281 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 282 | CLANG_WARN_EMPTY_BODY = YES; 283 | CLANG_WARN_ENUM_CONVERSION = YES; 284 | CLANG_WARN_INFINITE_RECURSION = YES; 285 | CLANG_WARN_INT_CONVERSION = YES; 286 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 287 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 288 | CLANG_WARN_UNREACHABLE_CODE = YES; 289 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 290 | CODE_SIGN_IDENTITY = "-"; 291 | COPY_PHASE_STRIP = NO; 292 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 293 | ENABLE_NS_ASSERTIONS = NO; 294 | ENABLE_STRICT_OBJC_MSGSEND = YES; 295 | GCC_C_LANGUAGE_STANDARD = gnu99; 296 | GCC_NO_COMMON_BLOCKS = YES; 297 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 298 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 299 | GCC_WARN_UNDECLARED_SELECTOR = YES; 300 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 301 | GCC_WARN_UNUSED_FUNCTION = YES; 302 | GCC_WARN_UNUSED_VARIABLE = YES; 303 | MACOSX_DEPLOYMENT_TARGET = 10.12; 304 | MTL_ENABLE_DEBUG_INFO = NO; 305 | SDKROOT = macosx; 306 | }; 307 | name = Release; 308 | }; 309 | 73731A651EEE33D9008EFEA4 /* Debug */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 313 | COMBINE_HIDPI_IMAGES = YES; 314 | DEVELOPMENT_TEAM = 8LQ7CL73D8; 315 | INFOPLIST_FILE = LBXScanUITool/Info.plist; 316 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 317 | PRODUCT_BUNDLE_IDENTIFIER = com.lbx.LBXScanUITool; 318 | PRODUCT_NAME = "$(TARGET_NAME)"; 319 | }; 320 | name = Debug; 321 | }; 322 | 73731A661EEE33D9008EFEA4 /* Release */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 326 | COMBINE_HIDPI_IMAGES = YES; 327 | DEVELOPMENT_TEAM = 8LQ7CL73D8; 328 | INFOPLIST_FILE = LBXScanUITool/Info.plist; 329 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 330 | PRODUCT_BUNDLE_IDENTIFIER = com.lbx.LBXScanUITool; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | }; 333 | name = Release; 334 | }; 335 | /* End XCBuildConfiguration section */ 336 | 337 | /* Begin XCConfigurationList section */ 338 | 73731A4B1EEE33D9008EFEA4 /* Build configuration list for PBXProject "LBXScanUITool" */ = { 339 | isa = XCConfigurationList; 340 | buildConfigurations = ( 341 | 73731A621EEE33D9008EFEA4 /* Debug */, 342 | 73731A631EEE33D9008EFEA4 /* Release */, 343 | ); 344 | defaultConfigurationIsVisible = 0; 345 | defaultConfigurationName = Release; 346 | }; 347 | 73731A641EEE33D9008EFEA4 /* Build configuration list for PBXNativeTarget "LBXScanUITool" */ = { 348 | isa = XCConfigurationList; 349 | buildConfigurations = ( 350 | 73731A651EEE33D9008EFEA4 /* Debug */, 351 | 73731A661EEE33D9008EFEA4 /* Release */, 352 | ); 353 | defaultConfigurationIsVisible = 0; 354 | defaultConfigurationName = Release; 355 | }; 356 | /* End XCConfigurationList section */ 357 | }; 358 | rootObject = 73731A481EEE33D9008EFEA4 /* Project object */; 359 | } 360 | -------------------------------------------------------------------------------- /LBXScanUITool.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LBXScanUITool/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/12. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LBXScanUITool/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/12. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 18 | // Insert code here to initialize your application 19 | } 20 | 21 | 22 | - (void)applicationWillTerminate:(NSNotification *)aNotification { 23 | // Insert code here to tear down your application 24 | } 25 | //- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize 26 | //{ 27 | // NSSize size = frameSize; 28 | // if (size.width < 1000) { 29 | // size.width = 1000; 30 | // } 31 | // 32 | // if (size.height < 700) 33 | // { 34 | // size.height = 700; 35 | // } 36 | // 37 | // return size; 38 | //} 39 | // 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/AppIcon.appiconset/20170509051036256_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/AppIcon.appiconset/20170509051036256_64.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/AppIcon.appiconset/20170509051221166_256-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/AppIcon.appiconset/20170509051221166_256-1.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/AppIcon.appiconset/20170509051221166_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/AppIcon.appiconset/20170509051221166_256.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "size" : "32x32", 20 | "idiom" : "mac", 21 | "filename" : "20170509051036256_64.png", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "idiom" : "mac", 26 | "size" : "128x128", 27 | "scale" : "1x" 28 | }, 29 | { 30 | "size" : "128x128", 31 | "idiom" : "mac", 32 | "filename" : "20170509051221166_256.png", 33 | "scale" : "2x" 34 | }, 35 | { 36 | "size" : "256x256", 37 | "idiom" : "mac", 38 | "filename" : "20170509051221166_256-1.png", 39 | "scale" : "1x" 40 | }, 41 | { 42 | "idiom" : "mac", 43 | "size" : "256x256", 44 | "scale" : "2x" 45 | }, 46 | { 47 | "idiom" : "mac", 48 | "size" : "512x512", 49 | "scale" : "1x" 50 | }, 51 | { 52 | "idiom" : "mac", 53 | "size" : "512x512", 54 | "scale" : "2x" 55 | } 56 | ], 57 | "info" : { 58 | "version" : 1, 59 | "author" : "xcode" 60 | } 61 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/backImg.imageset/11111.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/backImg.imageset/11111.jpg -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/backImg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "11111.jpg", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/device_scan.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "device_scan@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/device_scan.imageset/device_scan@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/device_scan.imageset/device_scan@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_Scan_weixin_Line.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_Scan_weixin_Line@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_Scan_weixin_Line.imageset/qrcode_Scan_weixin_Line@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_Scan_weixin_Line.imageset/qrcode_Scan_weixin_Line@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_flash_down.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_btn_flash_down@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_flash_down.imageset/qrcode_scan_btn_flash_down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_btn_flash_down.imageset/qrcode_scan_btn_flash_down@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_flash_nor.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_btn_flash_nor@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_flash_nor.imageset/qrcode_scan_btn_flash_nor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_btn_flash_nor.imageset/qrcode_scan_btn_flash_nor@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_myqrcode_down.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_btn_myqrcode_down@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_myqrcode_down.imageset/qrcode_scan_btn_myqrcode_down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_btn_myqrcode_down.imageset/qrcode_scan_btn_myqrcode_down@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_myqrcode_nor.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_btn_myqrcode_nor@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_myqrcode_nor.imageset/qrcode_scan_btn_myqrcode_nor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_btn_myqrcode_nor.imageset/qrcode_scan_btn_myqrcode_nor@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_photo_down.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_btn_photo_down@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_photo_down.imageset/qrcode_scan_btn_photo_down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_btn_photo_down.imageset/qrcode_scan_btn_photo_down@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_photo_nor.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_btn_photo_nor@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_photo_nor.imageset/qrcode_scan_btn_photo_nor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_btn_photo_nor.imageset/qrcode_scan_btn_photo_nor@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_scan_off.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_btn_scan_off@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_btn_scan_off.imageset/qrcode_scan_btn_scan_off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_btn_scan_off.imageset/qrcode_scan_btn_scan_off@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_full_net.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "qrcode_scan_full_net.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_full_net.imageset/qrcode_scan_full_net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_full_net.imageset/qrcode_scan_full_net.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_light_green.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_light_green@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_light_green.imageset/qrcode_scan_light_green@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_light_green.imageset/qrcode_scan_light_green@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_part_net.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "qrcode_scan_part_net.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_part_net.imageset/qrcode_scan_part_net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_part_net.imageset/qrcode_scan_part_net.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_titlebar_back_nor.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_titlebar_back_nor@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_titlebar_back_nor.imageset/qrcode_scan_titlebar_back_nor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_titlebar_back_nor.imageset/qrcode_scan_titlebar_back_nor@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_titlebar_back_pressed.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "qrcode_scan_titlebar_back_pressed@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /LBXScanUITool/Assets.xcassets/qrcode_scan_titlebar_back_pressed.imageset/qrcode_scan_titlebar_back_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/Assets.xcassets/qrcode_scan_titlebar_back_pressed.imageset/qrcode_scan_titlebar_back_pressed@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 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 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | Default 511 | 512 | 513 | 514 | 515 | 516 | 517 | Left to Right 518 | 519 | 520 | 521 | 522 | 523 | 524 | Right to Left 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | Default 536 | 537 | 538 | 539 | 540 | 541 | 542 | Left to Right 543 | 544 | 545 | 546 | 547 | 548 | 549 | Right to Left 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | -------------------------------------------------------------------------------- /LBXScanUITool/ClearTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // ClearTextField.h 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/16. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ClearTextField : NSTextField 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LBXScanUITool/ClearTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // ClearTextField.m 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/16. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import "ClearTextField.h" 10 | 11 | @implementation ClearTextField 12 | 13 | - (void)drawRect:(NSRect)dirtyRect { 14 | [super drawRect:dirtyRect]; 15 | 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LBXScanUITool/FlippedView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FlippedView.h 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/13. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FlippedView : NSView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LBXScanUITool/FlippedView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FlippedView.m 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/13. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import "FlippedView.h" 10 | 11 | @implementation FlippedView 12 | 13 | - (void)drawRect:(NSRect)dirtyRect { 14 | [super drawRect:dirtyRect]; 15 | 16 | // Drawing code here. 17 | } 18 | 19 | - (BOOL)isFlipped 20 | { 21 | return YES; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /LBXScanUITool/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2017年 lbx. All rights reserved. 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/device_scan@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/device_scan@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_Scan_weixin_Line@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_Scan_weixin_Line@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_flash_down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_flash_down@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_flash_nor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_flash_nor@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_myqrcode_down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_myqrcode_down@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_myqrcode_nor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_myqrcode_nor@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_photo_down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_photo_down@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_photo_nor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_photo_nor@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_scan_off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_btn_scan_off@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_full_net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_full_net.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_light_green@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_light_green@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_part_net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_part_net.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_titlebar_back_nor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_titlebar_back_nor@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_titlebar_back_pressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MxABC/LBXScanUITool/6d17a6af0cb09cca8f1c08d59e9f0e9bcd52fc31/LBXScanUITool/UI/CodeScan.bundle/qrcode_scan_titlebar_back_pressed@2x.png -------------------------------------------------------------------------------- /LBXScanUITool/UI/LBXScanLineAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // LBXScanLineAnimation.h 3 | // 4 | // github:https://github.com/MxABC/LBXScan 5 | // Created by lbxia on 15/11/3. 6 | // Copyright © 2015年 lbxia. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LBXScanLineAnimation : NSImageView 12 | 13 | 14 | 15 | /** 16 | * 开始扫码线动画 17 | * 18 | * @param animationRect 显示在parentView中得区域 19 | * @param parentView 动画显示在NSView 20 | * @param image 扫码线的图像 21 | */ 22 | - (void)startAnimatingWithRect:(CGRect)animationRect InView:(NSView*)parentView Image:(NSImage*)image; 23 | 24 | /** 25 | * 停止动画 26 | */ 27 | - (void)stopAnimating; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/LBXScanLineAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBXScanLineAnimation.m 3 | // 4 | // 5 | // Created by lbxia on 15/11/3. 6 | // Copyright © 2015年 lbxia. All rights reserved. 7 | // 8 | 9 | #import "LBXScanLineAnimation.h" 10 | #import "NSView+Extension.h" 11 | #import 12 | #import 13 | 14 | 15 | @interface LBXScanLineAnimation() 16 | { 17 | int num; 18 | BOOL down; 19 | NSTimer * timer; 20 | 21 | BOOL isAnimationing; 22 | } 23 | 24 | @property (nonatomic,assign) CGRect animationRect; 25 | 26 | @end 27 | 28 | 29 | 30 | @implementation LBXScanLineAnimation 31 | 32 | - (BOOL)isFlipped 33 | { 34 | return YES; 35 | } 36 | 37 | 38 | - (void)stepAnimation 39 | { 40 | if (!isAnimationing) { 41 | return; 42 | } 43 | 44 | CGFloat leftx = _animationRect.origin.x - 5; 45 | CGFloat width = _animationRect.size.width -10 ; 46 | 47 | self.frame = CGRectMake(leftx, _animationRect.origin.y + 8, width, 8); 48 | self.alpha = 1.0; 49 | self.hidden = NO; 50 | 51 | CAKeyframeAnimation *keyframeAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 52 | keyframeAnimation.duration = 3; 53 | keyframeAnimation.repeatCount = NSIntegerMax; 54 | CGAffineTransform transform = CGAffineTransformScale(CGAffineTransformIdentity, 1, 1); 55 | CGMutablePathRef path = CGPathCreateMutable(); 56 | 57 | 58 | CGPoint points[20]; 59 | CGFloat yMin = self.frame.origin.y + 8; 60 | CGFloat yMax = _animationRect.origin.y + _animationRect.size.height - 8; 61 | 62 | CGFloat diff = (yMax - yMin) / 20; 63 | for (int i = 0; i < 20; i++) { 64 | points[i] = CGPointMake(leftx, yMin + diff * i); 65 | } 66 | 67 | 68 | CGPathAddLines(path, &transform, points, 20); 69 | 70 | keyframeAnimation.path = path; 71 | CGPathRelease(path); 72 | [self.layer addAnimation:keyframeAnimation forKey:@""]; 73 | 74 | } 75 | 76 | 77 | 78 | - (void)startAnimatingWithRect:(CGRect)animationRect InView:(NSView *)parentView Image:(NSImage*)image 79 | { 80 | if (isAnimationing) { 81 | return; 82 | } 83 | 84 | isAnimationing = YES; 85 | 86 | 87 | self.animationRect = animationRect; 88 | down = YES; 89 | num = 0; 90 | 91 | CGFloat centery = CGRectGetMinY(animationRect) + CGRectGetHeight(animationRect)/2; 92 | CGFloat leftx = animationRect.origin.x + 5; 93 | CGFloat width = animationRect.size.width - 10; 94 | 95 | self.frame = CGRectMake(leftx, centery+2*num, width, 2); 96 | self.image = image; 97 | 98 | [parentView addSubview:self]; 99 | 100 | [self startAnimating_UIViewAnimation]; 101 | 102 | // [self startAnimating_NSTimer]; 103 | 104 | 105 | } 106 | 107 | - (void)startAnimating_UIViewAnimation 108 | { 109 | [self stepAnimation]; 110 | } 111 | 112 | - (void)startAnimating_NSTimer 113 | { 114 | timer = [NSTimer scheduledTimerWithTimeInterval:.02 target:self selector:@selector(scanLineAnimation) userInfo:nil repeats:YES]; 115 | } 116 | 117 | -(void)scanLineAnimation 118 | { 119 | CGFloat centery = CGRectGetMinY(_animationRect) + CGRectGetHeight(_animationRect)/2; 120 | CGFloat leftx = _animationRect.origin.x + 5; 121 | CGFloat width = _animationRect.size.width - 10; 122 | 123 | if (down) 124 | { 125 | num++; 126 | 127 | self.frame = CGRectMake(leftx, centery+2*num, width, 2); 128 | 129 | if (centery+2*num > (CGRectGetMinY(_animationRect) + CGRectGetHeight(_animationRect) - 5 ) ) 130 | { 131 | down = NO; 132 | } 133 | } 134 | else { 135 | num --; 136 | self.frame = CGRectMake(leftx, centery+2*num, width, 2); 137 | if (centery+2*num < (CGRectGetMinY(_animationRect) + 5 ) ) 138 | { 139 | down = YES; 140 | } 141 | } 142 | } 143 | 144 | - (void)dealloc 145 | { 146 | [self stopAnimating]; 147 | } 148 | 149 | - (void)stopAnimating 150 | { 151 | if (isAnimationing) { 152 | 153 | isAnimationing = NO; 154 | 155 | if (timer) { 156 | [timer invalidate]; 157 | timer = nil; 158 | } 159 | 160 | [self removeFromSuperview]; 161 | } 162 | [NSObject cancelPreviousPerformRequestsWithTarget:self]; 163 | } 164 | 165 | @end 166 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/LBXScanNetAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // LBXScanLineAnimation.h 3 | // 4 | // github:https://github.com/MxABC/LBXScan 5 | // Created by lbxia on 15/11/3. 6 | // Copyright © 2015年 lbxia. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LBXScanNetAnimation : NSView 12 | 13 | 14 | 15 | /** 16 | * 开始扫码网格效果 17 | * 18 | * @param animationRect 显示在parentView中得区域 19 | * @param parentView 动画显示在NSView 20 | * @param image 扫码线的图像 21 | */ 22 | - (void)startAnimatingWithRect:(CGRect)animationRect InView:(NSView*)parentView Image:(NSImage*)image; 23 | 24 | /** 25 | * 停止动画 26 | */ 27 | - (void)stopAnimating; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/LBXScanNetAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBXScanLineAnimation.m 3 | // 4 | // 5 | // Created by lbxia on 15/11/3. 6 | // Copyright © 2015年 lbxia. All rights reserved. 7 | // 8 | 9 | #import "LBXScanNetAnimation.h" 10 | #import "NSView+Extension.h" 11 | 12 | @interface LBXScanNetAnimation() 13 | { 14 | BOOL isAnimationing; 15 | } 16 | 17 | @property (nonatomic,assign) CGRect animationRect; 18 | @property (nonatomic,strong) NSImageView *scanImageView; 19 | 20 | @end 21 | 22 | @implementation LBXScanNetAnimation 23 | 24 | - (instancetype)init{ 25 | self = [super init]; 26 | if (self) { 27 | // self.clipsToBounds = YES; 28 | [self addSubview:self.scanImageView]; 29 | } 30 | return self; 31 | } 32 | 33 | - (NSImageView *)scanImageView{ 34 | if (!_scanImageView) { 35 | _scanImageView = [[NSImageView alloc] init]; 36 | } 37 | return _scanImageView; 38 | } 39 | 40 | - (void)stepAnimation 41 | { 42 | if (!isAnimationing) { 43 | return; 44 | } 45 | 46 | self.frame = _animationRect; 47 | 48 | CGFloat scanNetImageViewW = self.frame.size.width; 49 | CGFloat scanNetImageH = self.frame.size.height; 50 | 51 | __weak __typeof(self) weakSelf = self; 52 | self.alpha = 0.5; 53 | 54 | 55 | 56 | _scanImageView.frame = CGRectMake(0, -scanNetImageH, scanNetImageViewW, scanNetImageH); 57 | 58 | // [NSView animateWithDuration:1.4 animations:^{ 59 | // weakSelf.alpha = 1.0; 60 | // 61 | // _scanImageView.frame = CGRectMake(0, scanNetImageViewW-scanNetImageH, scanNetImageViewW, scanNetImageH); 62 | // 63 | // } completion:^(BOOL finished) 64 | // { 65 | // [weakSelf performSelector:@selector(stepAnimation) withObject:nil afterDelay:0.3]; 66 | // }]; 67 | } 68 | 69 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{ 70 | [self performSelector:@selector(stepAnimation) withObject:nil afterDelay:0.3]; 71 | } 72 | 73 | 74 | - (void)startAnimatingWithRect:(CGRect)animationRect InView:(NSView *)parentView Image:(NSImage*)image 75 | { 76 | [self.scanImageView setImage:image]; 77 | 78 | self.animationRect = animationRect; 79 | 80 | [parentView addSubview:self]; 81 | 82 | self.hidden = NO; 83 | 84 | isAnimationing = YES; 85 | 86 | [self stepAnimation]; 87 | } 88 | 89 | 90 | - (void)dealloc 91 | { 92 | [self stopAnimating]; 93 | } 94 | 95 | - (void)stopAnimating 96 | { 97 | self.hidden = YES; 98 | isAnimationing = NO; 99 | 100 | [NSObject cancelPreviousPerformRequestsWithTarget:self]; 101 | } 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/LBXScanView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LBXScanView.h 3 | // 4 | // github:https://github.com/MxABC/LBXScan 5 | // Created by lbxia on 15/11/15. 6 | // Copyright © 2015年 lbxia. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | #import "LBXScanLineAnimation.h" 12 | #import "LBXScanNetAnimation.h" 13 | #import "LBXScanViewStyle.h" 14 | 15 | #define LBXScan_Define_UI 16 | 17 | /** 18 | 扫码区域显示效果 19 | */ 20 | @interface LBXScanView : NSView 21 | //扫码区域各种参数 22 | @property (nonatomic, strong) LBXScanViewStyle* viewStyle; 23 | /** 24 | @brief 初始化 25 | @param frame 位置大小 26 | @param style 类型 27 | 28 | @return instancetype 29 | */ 30 | -(id)initWithFrame:(CGRect)frame style:(LBXScanViewStyle*)style; 31 | 32 | /** 33 | * 设备启动中文字提示 34 | */ 35 | - (void)startDeviceReadyingWithText:(NSString*)text; 36 | 37 | /** 38 | * 设备启动完成 39 | */ 40 | - (void)stopDeviceReadying; 41 | 42 | /** 43 | * 开始扫描动画 44 | */ 45 | - (void)startScanAnimation; 46 | 47 | /** 48 | * 结束扫描动画 49 | */ 50 | - (void)stopScanAnimation; 51 | 52 | 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/LBXScanView.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // LBXScanView.m 4 | // 5 | // 6 | // Created by lbxia on 15/11/15. 7 | // Copyright © 2015年 lbxia. All rights reserved. 8 | // 9 | 10 | #import "LBXScanView.h" 11 | 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface LBXScanView() 16 | 17 | 18 | 19 | 20 | //扫码区域 21 | @property (nonatomic,assign)CGRect scanRetangleRect; 22 | 23 | //线条扫码动画封装 24 | @property (nonatomic,strong,nullable)LBXScanLineAnimation *scanLineAnimation; 25 | //网格扫码动画封装 26 | @property (nonatomic,strong,nullable)LBXScanNetAnimation *scanNetAnimation; 27 | 28 | //线条在中间位置,不移动 29 | @property (nonatomic,strong,nullable)NSImageView *scanLineStill; 30 | 31 | /** 32 | @brief 启动相机时 菊花等待 33 | */ 34 | //@property(nonatomic,strong,nullable)UIActivityIndicatorView* activityView; 35 | 36 | /** 37 | @brief 启动相机中的提示文字 38 | */ 39 | //@property(nonatomic,strong,nullable)UILabel *labelReadying; 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | 45 | @implementation LBXScanView 46 | 47 | 48 | -(id)initWithFrame:(CGRect)frame style:(LBXScanViewStyle*)style 49 | { 50 | if (self = [super initWithFrame:frame]) 51 | { 52 | self.viewStyle = style; 53 | 54 | } 55 | return self; 56 | } 57 | 58 | - (BOOL)isFlipped 59 | { 60 | return YES; 61 | } 62 | 63 | - (void)drawRect:(CGRect)rect 64 | { 65 | [self drawScanRect]; 66 | } 67 | - (void)startDeviceReadyingWithText:(NSString*)text 68 | { 69 | int XRetangleLeft = _viewStyle.xScanRetangleOffset; 70 | 71 | CGSize sizeRetangle = CGSizeMake(self.frame.size.width - XRetangleLeft*2, self.frame.size.width - XRetangleLeft*2); 72 | 73 | if (!_viewStyle.isNeedShowRetangle) { 74 | 75 | CGFloat w = sizeRetangle.width; 76 | CGFloat h = w / _viewStyle.whRatio; 77 | 78 | NSInteger hInt = (NSInteger)h; 79 | h = hInt; 80 | 81 | sizeRetangle = CGSizeMake(w, h); 82 | } 83 | 84 | //扫码区域Y轴最小坐标 85 | CGFloat YMinRetangle = self.frame.size.height / 2.0 - sizeRetangle.height/2.0 - _viewStyle.centerUpOffset; 86 | 87 | // //设备启动状态提示 88 | // if (!_activityView) 89 | // { 90 | // self.activityView = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(0, 0, 30, 30)]; 91 | // [_activityView setCenter:CGPointMake(XRetangleLeft + sizeRetangle.width/2 - 50, YMinRetangle + sizeRetangle.height/2)]; 92 | // 93 | // [_activityView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge]; 94 | // [self addSubview:_activityView]; 95 | // 96 | // CGRect labelReadyRect = CGRectMake(_activityView.frame.origin.x + _activityView.frame.size.width + 10, _activityView.frame.origin.y, 100, 30); 97 | // self.labelReadying = [[UILabel alloc]initWithFrame:labelReadyRect]; 98 | // _labelReadying.backgroundColor = [UIColor clearColor]; 99 | // _labelReadying.textColor = [UIColor whiteColor]; 100 | // _labelReadying.font = [UIFont systemFontOfSize:18.]; 101 | // _labelReadying.text = text; 102 | // 103 | // [self addSubview:_labelReadying]; 104 | // 105 | // [_activityView startAnimating]; 106 | // } 107 | 108 | } 109 | 110 | - (void)stopDeviceReadying 111 | { 112 | // if (_activityView) { 113 | // 114 | // [_activityView stopAnimating]; 115 | // [_activityView removeFromSuperview]; 116 | // [_labelReadying removeFromSuperview]; 117 | // 118 | // self.activityView = nil; 119 | // self.labelReadying = nil; 120 | // } 121 | } 122 | 123 | 124 | /** 125 | * 开始扫描动画 126 | */ 127 | - (void)startScanAnimation 128 | { 129 | [self computeScanRect]; 130 | switch (_viewStyle.anmiationStyle) 131 | { 132 | case LBXScanViewAnimationStyle_LineMove: 133 | { 134 | //线动画 135 | if (!_scanLineAnimation) 136 | self.scanLineAnimation = [[LBXScanLineAnimation alloc]init]; 137 | [_scanLineAnimation startAnimatingWithRect:_scanRetangleRect 138 | InView:self 139 | Image:_viewStyle.animationImage]; 140 | } 141 | break; 142 | case LBXScanViewAnimationStyle_NetGrid: 143 | { 144 | //网格动画 145 | if (!_scanNetAnimation) 146 | self.scanNetAnimation = [[LBXScanNetAnimation alloc]init]; 147 | [_scanNetAnimation startAnimatingWithRect:_scanRetangleRect 148 | InView:self 149 | Image:_viewStyle.animationImage]; 150 | } 151 | break; 152 | case LBXScanViewAnimationStyle_LineStill: 153 | { 154 | if (!_scanLineStill) { 155 | 156 | CGRect stillRect = CGRectMake(_scanRetangleRect.origin.x+20, 157 | _scanRetangleRect.origin.y + _scanRetangleRect.size.height/2, 158 | _scanRetangleRect.size.width-40, 159 | 2); 160 | _scanLineStill = [[NSImageView alloc]initWithFrame:stillRect]; 161 | _scanLineStill.image = _viewStyle.animationImage; 162 | } 163 | [self addSubview:_scanLineStill]; 164 | } 165 | 166 | default: 167 | break; 168 | } 169 | 170 | } 171 | 172 | 173 | 174 | /** 175 | * 结束扫描动画 176 | */ 177 | - (void)stopScanAnimation 178 | { 179 | if (_scanLineAnimation) { 180 | [_scanLineAnimation stopAnimating]; 181 | } 182 | 183 | if (_scanNetAnimation) { 184 | [_scanNetAnimation stopAnimating]; 185 | } 186 | 187 | if (_scanLineStill) { 188 | [_scanLineStill removeFromSuperview]; 189 | } 190 | } 191 | 192 | 193 | - (void)drawScanRect 194 | { 195 | int XRetangleLeft = _viewStyle.xScanRetangleOffset; 196 | 197 | CGSize sizeRetangle = CGSizeMake(self.frame.size.width - XRetangleLeft*2, self.frame.size.width - XRetangleLeft*2); 198 | 199 | //if (!_viewStyle.isScanRetangelSquare) 200 | if (_viewStyle.whRatio != 1) 201 | { 202 | CGFloat w = sizeRetangle.width; 203 | CGFloat h = w / _viewStyle.whRatio; 204 | 205 | NSInteger hInt = (NSInteger)h; 206 | h = hInt; 207 | 208 | sizeRetangle = CGSizeMake(w, h); 209 | } 210 | 211 | //扫码区域Y轴最小坐标 212 | CGFloat YMinRetangle = self.frame.size.height / 2.0 - sizeRetangle.height/2.0 - _viewStyle.centerUpOffset; 213 | CGFloat YMaxRetangle = YMinRetangle + sizeRetangle.height; 214 | CGFloat XRetangleRight = self.frame.size.width - XRetangleLeft; 215 | 216 | 217 | 218 | // NSLog(@"frame:%d",NSStringFromCGRect(self.frame)); 219 | 220 | // CGContextRef context = UIGraphicsGetCurrentContext(); 221 | 222 | CGContextRef context = [NSGraphicsContext currentContext].CGContext; 223 | 224 | 225 | 226 | //非扫码区域半透明 227 | { 228 | //设置非识别区域颜色 229 | 230 | const CGFloat *components = CGColorGetComponents(_viewStyle.notRecoginitonArea.CGColor); 231 | 232 | 233 | CGFloat red_notRecoginitonArea = components[0]; 234 | CGFloat green_notRecoginitonArea = components[1]; 235 | CGFloat blue_notRecoginitonArea = components[2]; 236 | CGFloat alpa_notRecoginitonArea = components[3]; 237 | 238 | 239 | CGContextSetRGBFillColor(context, red_notRecoginitonArea, green_notRecoginitonArea, 240 | blue_notRecoginitonArea, alpa_notRecoginitonArea); 241 | 242 | //填充矩形 243 | 244 | //扫码区域上面填充 245 | CGRect rect = CGRectMake(0, 0, self.frame.size.width, YMinRetangle); 246 | CGContextFillRect(context, rect); 247 | 248 | 249 | //扫码区域左边填充 250 | rect = CGRectMake(0, YMinRetangle, XRetangleLeft,sizeRetangle.height); 251 | CGContextFillRect(context, rect); 252 | 253 | //扫码区域右边填充 254 | rect = CGRectMake(XRetangleRight, YMinRetangle, XRetangleLeft,sizeRetangle.height); 255 | CGContextFillRect(context, rect); 256 | 257 | //扫码区域下面填充 258 | rect = CGRectMake(0, YMaxRetangle, self.frame.size.width,self.frame.size.height - YMaxRetangle); 259 | CGContextFillRect(context, rect); 260 | //执行绘画 261 | CGContextStrokePath(context); 262 | } 263 | 264 | if (_viewStyle.isNeedShowRetangle) 265 | { 266 | //中间画矩形(正方形) 267 | CGContextSetStrokeColorWithColor(context, _viewStyle.colorRetangleLine.CGColor); 268 | CGContextSetLineWidth(context, 1); 269 | 270 | CGContextAddRect(context, CGRectMake(XRetangleLeft, YMinRetangle, sizeRetangle.width, sizeRetangle.height)); 271 | 272 | //CGContextMoveToPoint(context, XRetangleLeft, YMinRetangle); 273 | //CGContextAddLineToPoint(context, XRetangleLeft+sizeRetangle.width, YMinRetangle); 274 | 275 | CGContextStrokePath(context); 276 | 277 | } 278 | _scanRetangleRect = CGRectMake(XRetangleLeft, YMinRetangle, sizeRetangle.width, sizeRetangle.height); 279 | 280 | 281 | //画矩形框4格外围相框角 282 | 283 | //相框角的宽度和高度 284 | int wAngle = _viewStyle.photoframeAngleW; 285 | int hAngle = _viewStyle.photoframeAngleH; 286 | 287 | //4个角的 线的宽度 288 | CGFloat linewidthAngle = _viewStyle.photoframeLineW;// 经验参数:6和4 289 | 290 | //画扫码矩形以及周边半透明黑色坐标参数 291 | CGFloat diffAngle = 0.0f; 292 | //diffAngle = linewidthAngle / 2; //框外面4个角,与框有缝隙 293 | //diffAngle = linewidthAngle/2; //框4个角 在线上加4个角效果 294 | //diffAngle = 0;//与矩形框重合 295 | 296 | switch (_viewStyle.photoframeAngleStyle) 297 | { 298 | case LBXScanViewPhotoframeAngleStyle_None: 299 | return; 300 | break; 301 | 302 | case LBXScanViewPhotoframeAngleStyle_Outer: 303 | { 304 | diffAngle = linewidthAngle/3;//框外面4个角,与框紧密联系在一起 305 | } 306 | break; 307 | case LBXScanViewPhotoframeAngleStyle_On: 308 | { 309 | diffAngle = 0; 310 | } 311 | break; 312 | case LBXScanViewPhotoframeAngleStyle_Inner: 313 | { 314 | diffAngle = -_viewStyle.photoframeLineW/2; 315 | 316 | } 317 | break; 318 | 319 | default: 320 | { 321 | diffAngle = linewidthAngle/3; 322 | } 323 | break; 324 | } 325 | 326 | 327 | CGContextSetStrokeColorWithColor(context, _viewStyle.colorAngle.CGColor); 328 | CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0); 329 | 330 | // Draw them with a 2.0 stroke width so they are a bit more visible. 331 | CGContextSetLineWidth(context, linewidthAngle); 332 | 333 | 334 | // 335 | CGFloat leftX = XRetangleLeft - diffAngle; 336 | CGFloat topY = YMinRetangle - diffAngle; 337 | CGFloat rightX = XRetangleRight + diffAngle; 338 | CGFloat bottomY = YMaxRetangle + diffAngle; 339 | 340 | //左上角水平线 341 | CGContextMoveToPoint(context, leftX-linewidthAngle/2, topY); 342 | CGContextAddLineToPoint(context, leftX + wAngle, topY); 343 | 344 | //左上角垂直线 345 | CGContextMoveToPoint(context, leftX, topY-linewidthAngle/2); 346 | CGContextAddLineToPoint(context, leftX, topY+hAngle); 347 | 348 | 349 | //左下角水平线 350 | CGContextMoveToPoint(context, leftX-linewidthAngle/2, bottomY); 351 | CGContextAddLineToPoint(context, leftX + wAngle, bottomY); 352 | 353 | //左下角垂直线 354 | CGContextMoveToPoint(context, leftX, bottomY+linewidthAngle/2); 355 | CGContextAddLineToPoint(context, leftX, bottomY - hAngle); 356 | 357 | 358 | //右上角水平线 359 | CGContextMoveToPoint(context, rightX+linewidthAngle/2, topY); 360 | CGContextAddLineToPoint(context, rightX - wAngle, topY); 361 | 362 | //右上角垂直线 363 | CGContextMoveToPoint(context, rightX, topY-linewidthAngle/2); 364 | CGContextAddLineToPoint(context, rightX, topY + hAngle); 365 | 366 | 367 | //右下角水平线 368 | CGContextMoveToPoint(context, rightX+linewidthAngle/2, bottomY); 369 | CGContextAddLineToPoint(context, rightX - wAngle, bottomY); 370 | 371 | //右下角垂直线 372 | CGContextMoveToPoint(context, rightX, bottomY+linewidthAngle/2); 373 | CGContextAddLineToPoint(context, rightX, bottomY - hAngle); 374 | 375 | CGContextStrokePath(context); 376 | } 377 | 378 | - (void)computeScanRect 379 | { 380 | int XRetangleLeft = _viewStyle.xScanRetangleOffset; 381 | 382 | CGSize sizeRetangle = CGSizeMake(self.frame.size.width - XRetangleLeft*2, self.frame.size.width - XRetangleLeft*2); 383 | 384 | //if (!_viewStyle.isScanRetangelSquare) 385 | if (_viewStyle.whRatio != 1) 386 | { 387 | CGFloat w = sizeRetangle.width; 388 | CGFloat h = w / _viewStyle.whRatio; 389 | 390 | NSInteger hInt = (NSInteger)h; 391 | h = hInt; 392 | 393 | sizeRetangle = CGSizeMake(w, h); 394 | } 395 | 396 | //扫码区域Y轴最小坐标 397 | CGFloat YMinRetangle = self.frame.size.height / 2.0 - sizeRetangle.height/2.0 - _viewStyle.centerUpOffset; 398 | 399 | _scanRetangleRect = CGRectMake(XRetangleLeft, YMinRetangle, sizeRetangle.width, sizeRetangle.height); 400 | } 401 | 402 | 403 | - (void)drawScanRect2 404 | { 405 | int XRetangleLeft = _viewStyle.xScanRetangleOffset; 406 | 407 | CGSize sizeRetangle = CGSizeMake(self.frame.size.width - XRetangleLeft*2, self.frame.size.width - XRetangleLeft*2); 408 | 409 | //if (!_viewStyle.isScanRetangelSquare) 410 | if (_viewStyle.whRatio != 1) 411 | { 412 | CGFloat w = sizeRetangle.width; 413 | CGFloat h = w / _viewStyle.whRatio; 414 | 415 | NSInteger hInt = (NSInteger)h; 416 | h = hInt; 417 | 418 | sizeRetangle = CGSizeMake(w, h); 419 | } 420 | 421 | //扫码区域Y轴最小坐标 422 | CGFloat YMinRetangle = self.frame.size.height / 2.0 - sizeRetangle.height/2.0 - _viewStyle.centerUpOffset; 423 | CGFloat YMaxRetangle = YMinRetangle + sizeRetangle.height; 424 | CGFloat XRetangleRight = self.frame.size.width - XRetangleLeft; 425 | 426 | 427 | 428 | //--------绘制矩形---- 429 | 430 | int SH = self.frame.size.height; 431 | 432 | // NSRect rect1 = NSMakeRect(SH*0.5, SH-100, 30, 20); 433 | 434 | 435 | // NSRect rect2 = NSMakeRect(SH*0.5, SH-130, 30, 20); 436 | 437 | 438 | //填充矩形 439 | 440 | 441 | // [NSBezierPath fillRect:rect1]; 442 | 443 | 444 | //绘制矩形 445 | NSRect rect = CGRectMake(XRetangleLeft, YMinRetangle, sizeRetangle.width, sizeRetangle.height); 446 | [_viewStyle.colorRetangleLine setStroke]; 447 | [NSBezierPath strokeRect:rect]; 448 | 449 | //绘制4个相框角 450 | 451 | //--------绘制线条(十字线)---- 452 | 453 | 454 | // [[NSColor greenColor] set]; 455 | // 456 | // 457 | // NSPoint bm =NSMakePoint(SW*0.5, 0); 458 | // 459 | // 460 | // NSPoint top =NSMakePoint(SW*0.5, SH); 461 | // 462 | // 463 | // NSPoint lf =NSMakePoint(0, SH*0.5); 464 | // 465 | // 466 | // NSPoint rt =NSMakePoint(SW, SH*0.5); 467 | // 468 | // 469 | // [NSBezierPath strokeLineFromPoint:bm toPoint:top]; 470 | // 471 | // 472 | // [NSBezierPath strokeLineFromPoint:lf toPoint:rt]; 473 | 474 | 475 | //画矩形框4格外围相框角 476 | 477 | //相框角的宽度和高度 478 | int wAngle = _viewStyle.photoframeAngleW; 479 | int hAngle = _viewStyle.photoframeAngleH; 480 | 481 | //4个角的 线的宽度 482 | CGFloat linewidthAngle = _viewStyle.photoframeLineW;// 经验参数:6和4 483 | 484 | //画扫码矩形以及周边半透明黑色坐标参数 485 | CGFloat diffAngle = 0.0f; 486 | //diffAngle = linewidthAngle / 2; //框外面4个角,与框有缝隙 487 | //diffAngle = linewidthAngle/2; //框4个角 在线上加4个角效果 488 | //diffAngle = 0;//与矩形框重合 489 | 490 | switch (_viewStyle.photoframeAngleStyle) 491 | { 492 | case LBXScanViewPhotoframeAngleStyle_Outer: 493 | { 494 | diffAngle = linewidthAngle/3;//框外面4个角,与框紧密联系在一起 495 | } 496 | break; 497 | case LBXScanViewPhotoframeAngleStyle_On: 498 | { 499 | diffAngle = 0; 500 | } 501 | break; 502 | case LBXScanViewPhotoframeAngleStyle_Inner: 503 | { 504 | diffAngle = -_viewStyle.photoframeLineW/2; 505 | 506 | } 507 | break; 508 | 509 | default: 510 | { 511 | diffAngle = linewidthAngle/3; 512 | } 513 | break; 514 | } 515 | 516 | 517 | CGContextRef context = [NSGraphicsContext currentContext].CGContext; 518 | 519 | // context = 520 | 521 | CGContextSetStrokeColorWithColor(context, _viewStyle.colorAngle.CGColor); 522 | CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0); 523 | 524 | // Draw them with a 2.0 stroke width so they are a bit more visible. 525 | CGContextSetLineWidth(context, linewidthAngle); 526 | 527 | 528 | 529 | 530 | CGContextSetStrokeColorWithColor(context, _viewStyle.colorAngle.CGColor); 531 | // 532 | CGFloat leftX = XRetangleLeft - diffAngle; 533 | CGFloat topY = YMinRetangle - diffAngle; 534 | CGFloat rightX = XRetangleRight + diffAngle; 535 | CGFloat bottomY = YMaxRetangle + diffAngle; 536 | 537 | 538 | //左上角水平线 539 | CGContextMoveToPoint(context, leftX-linewidthAngle/2, topY); 540 | CGContextAddLineToPoint(context, leftX + wAngle, topY); 541 | 542 | //左上角垂直线 543 | CGContextMoveToPoint(context, leftX, topY-linewidthAngle/2); 544 | CGContextAddLineToPoint(context, leftX, topY+hAngle); 545 | 546 | 547 | //左下角水平线 548 | CGContextMoveToPoint(context, leftX-linewidthAngle/2, bottomY); 549 | CGContextAddLineToPoint(context, leftX + wAngle, bottomY); 550 | 551 | //左下角垂直线 552 | CGContextMoveToPoint(context, leftX, bottomY+linewidthAngle/2); 553 | CGContextAddLineToPoint(context, leftX, bottomY - hAngle); 554 | 555 | 556 | //右上角水平线 557 | CGContextMoveToPoint(context, rightX+linewidthAngle/2, topY); 558 | CGContextAddLineToPoint(context, rightX - wAngle, topY); 559 | 560 | //右上角垂直线 561 | CGContextMoveToPoint(context, rightX, topY-linewidthAngle/2); 562 | CGContextAddLineToPoint(context, rightX, topY + hAngle); 563 | 564 | 565 | //右下角水平线 566 | CGContextMoveToPoint(context, rightX+linewidthAngle/2, bottomY); 567 | CGContextAddLineToPoint(context, rightX - wAngle, bottomY); 568 | 569 | //右下角垂直线 570 | CGContextMoveToPoint(context, rightX, bottomY+linewidthAngle/2); 571 | CGContextAddLineToPoint(context, rightX, bottomY - hAngle); 572 | 573 | CGContextStrokePath(context); 574 | 575 | 576 | 577 | } 578 | 579 | 580 | 581 | 582 | @end 583 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/LBXScanViewStyle.h: -------------------------------------------------------------------------------- 1 | // 2 | // LBXScanViewStyle.h 3 | // 4 | // github:https://github.com/MxABC/LBXScan 5 | // Created by lbxia on 15/11/15. 6 | // Copyright © 2015年 lbxia. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | /** 14 | 扫码区域动画效果 15 | */ 16 | typedef NS_ENUM(NSInteger,LBXScanViewAnimationStyle) 17 | { 18 | LBXScanViewAnimationStyle_LineMove, //线条上下移动 19 | LBXScanViewAnimationStyle_NetGrid,//网格 20 | LBXScanViewAnimationStyle_LineStill,//线条停止在扫码区域中央 21 | LBXScanViewAnimationStyle_None //无动画 22 | 23 | }; 24 | 25 | /** 26 | 扫码区域4个角位置类型 27 | */ 28 | typedef NS_ENUM(NSInteger, LBXScanViewPhotoframeAngleStyle) 29 | { 30 | LBXScanViewPhotoframeAngleStyle_Inner,//内嵌,一般不显示矩形框情况下 31 | LBXScanViewPhotoframeAngleStyle_Outer,//外嵌,包围在矩形框的4个角 32 | LBXScanViewPhotoframeAngleStyle_On, //在矩形框的4个角上,覆盖 33 | LBXScanViewPhotoframeAngleStyle_None //无 34 | }; 35 | 36 | 37 | NS_ASSUME_NONNULL_BEGIN 38 | 39 | @interface LBXScanViewStyle : NSObject 40 | 41 | 42 | #pragma mark -中心位置矩形框 43 | /** 44 | @brief 是否需要绘制扫码矩形框,默认YES 45 | */ 46 | @property (nonatomic, assign) BOOL isNeedShowRetangle; 47 | 48 | 49 | /** 50 | * 默认扫码区域为正方形,如果扫码区域不是正方形,设置宽高比 51 | */ 52 | @property (nonatomic, assign) CGFloat whRatio; 53 | 54 | 55 | /** 56 | @brief 矩形框(视频显示透明区)域向上移动偏移量,0表示扫码透明区域在当前视图中心位置,< 0 表示扫码区域下移, >0 表示扫码区域上移 57 | */ 58 | @property (nonatomic, assign) CGFloat centerUpOffset; 59 | 60 | /** 61 | * 矩形框(视频显示透明区)域离界面左边及右边距离,默认60 62 | */ 63 | @property (nonatomic, assign) CGFloat xScanRetangleOffset; 64 | 65 | /** 66 | @brief 矩形框线条颜色 67 | */ 68 | @property (nonatomic, strong) NSColor *colorRetangleLine; 69 | 70 | 71 | 72 | #pragma mark -矩形框(扫码区域)周围4个角 73 | /** 74 | @brief 扫码区域的4个角类型 75 | */ 76 | @property (nonatomic, assign) LBXScanViewPhotoframeAngleStyle photoframeAngleStyle; 77 | 78 | //4个角的颜色 79 | @property (nonatomic, strong) NSColor* colorAngle; 80 | 81 | //扫码区域4个角的宽度和高度 82 | @property (nonatomic, assign) CGFloat photoframeAngleW; 83 | @property (nonatomic, assign) CGFloat photoframeAngleH; 84 | /** 85 | @brief 扫码区域4个角的线条宽度,默认6,建议8到4之间 86 | */ 87 | @property (nonatomic, assign) CGFloat photoframeLineW; 88 | 89 | 90 | 91 | 92 | #pragma mark --动画效果 93 | /** 94 | @brief 扫码动画效果:线条或网格 95 | */ 96 | @property (nonatomic, assign) LBXScanViewAnimationStyle anmiationStyle; 97 | 98 | /** 99 | * 动画效果的图像,如线条或网格的图像,如果为nil,表示不需要动画效果 100 | */ 101 | @property (nonatomic,strong,nullable) NSImage *animationImage; 102 | 103 | 104 | 105 | #pragma mark -非识别区域颜色,默认 RGBA (0,0,0,0.5) 106 | 107 | /** 108 | must be create by [UIColor colorWithRed: green: blue: alpha:] 109 | */ 110 | //notRecognitionArea 111 | @property (nonatomic, strong) NSColor *notRecoginitonArea; 112 | 113 | 114 | @end 115 | 116 | NS_ASSUME_NONNULL_END 117 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/LBXScanViewStyle.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBXScanViewStyle.m 3 | // 4 | // 5 | // Created by lbxia on 15/11/15. 6 | // Copyright © 2015年 lbxia. All rights reserved. 7 | // 8 | 9 | #import "LBXScanViewStyle.h" 10 | 11 | @implementation LBXScanViewStyle 12 | 13 | - (id)init 14 | { 15 | if (self = [super init]) 16 | { 17 | _isNeedShowRetangle = YES; 18 | 19 | _whRatio = 1.0; 20 | 21 | _colorRetangleLine = [NSColor colorWithRed:1 green:1 blue:1 alpha:1]; 22 | 23 | _centerUpOffset = 44; 24 | _xScanRetangleOffset = 60; 25 | 26 | _anmiationStyle = LBXScanViewAnimationStyle_LineMove; 27 | _photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Outer; 28 | 29 | _colorAngle = [NSColor colorWithRed:0. green:167./255. blue:231./255. alpha:1.0]; 30 | _colorAngle = [NSColor colorWithRed:0. green:167./255. blue:231./255. alpha:1.0]; 31 | 32 | _notRecoginitonArea = [NSColor colorWithRed:0. green:.0 blue:.0 alpha:.5]; 33 | 34 | // _notRecoginitonArea = [NSColor redColor]; 35 | 36 | 37 | _photoframeAngleW = 24; 38 | _photoframeAngleH = 24; 39 | _photoframeLineW = 7; 40 | 41 | } 42 | 43 | return self; 44 | } 45 | 46 | @end 47 | 48 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/NSView+Extension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSView+Extension.h 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/12. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSView (Extension) 12 | //@property (nonatomic, assign) CGFloat alpha; 13 | 14 | - (void)setAlpha:(CGFloat)alpha; 15 | 16 | - (void)setBackGroundColor:(NSColor*)color; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LBXScanUITool/UI/NSView+Extension.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSView+Extension.m 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/12. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import "NSView+Extension.h" 10 | 11 | @implementation NSView (Extension) 12 | 13 | 14 | - (void)setAlpha:(CGFloat)alpha 15 | { 16 | [self setWantsLayer:YES]; 17 | 18 | [self setAlphaValue:alpha]; 19 | 20 | } 21 | 22 | - (void)setBackGroundColor:(NSColor*)color 23 | { 24 | [self setWantsLayer:YES]; 25 | [self.layer setBackgroundColor:color.CGColor]; 26 | 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /LBXScanUITool/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/12. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FlippedView.h" 11 | #import "LBXScanViewStyle.h" 12 | 13 | #import "LBXScanView.h" 14 | 15 | @interface ViewController : NSViewController 16 | @property (weak) IBOutlet FlippedView *iphoneView; 17 | 18 | @property (nonatomic, strong) LBXScanViewStyle *style; 19 | @property (nonatomic, strong) LBXScanView *scanView; 20 | 21 | @property (weak) IBOutlet NSButton *checkBox_isNeedShowRetangle; 22 | @property (weak) IBOutlet NSSlider *slider_wRation; 23 | @property (weak) IBOutlet NSSlider *slider_centerUpOffset; 24 | @property (weak) IBOutlet NSSlider *slider_xScanRetangleOffset; 25 | 26 | @property (weak) IBOutlet NSSlider *slider_photoframeAngleW; 27 | @property (weak) IBOutlet NSSlider *slider_photoframeAngleH; 28 | @property (weak) IBOutlet NSSlider *slider_photoframeLineW; 29 | 30 | @property (weak) IBOutlet NSSlider *slider_notRecoginitonArea_Alpa; 31 | 32 | @property (weak) IBOutlet NSPopUpButton *popUpButton_photoframeAngleStyle; 33 | 34 | #pragma mark ---- 颜色选择按钮 ----- 35 | 36 | @property (nonatomic, weak) NSButton *preButton; 37 | 38 | //colorRetangleLine 选择颜色按钮 39 | @property (weak) IBOutlet NSButton *colorPanel_colorRetangleLine; 40 | 41 | //扫码框周围4个角的线条颜色 选择按钮 42 | @property (weak) IBOutlet NSButton *colorPanel_colorAngle; 43 | @property (weak) IBOutlet NSButton *colorPanel_notRecoginitonArea; 44 | 45 | #pragma mark ---- 结果显示label ---- 46 | 47 | @property (weak) IBOutlet NSTextField *label_whRatio; 48 | @property (weak) IBOutlet NSTextField *label_centerUpOffset; 49 | @property (weak) IBOutlet NSTextField *label_xScanRetangleOffset; 50 | @property (weak) IBOutlet NSTextField *label_colorRetangleLine; 51 | @property (weak) IBOutlet NSTextField *label_colorAngle; 52 | @property (weak) IBOutlet NSTextField *label_photoframeAngleW; 53 | @property (weak) IBOutlet NSTextField *label_photoframeAngleH; 54 | @property (weak) IBOutlet NSTextField *label_photoframeLineW; 55 | @property (weak) IBOutlet NSTextField *label_notRecoginitonArea; 56 | @property (weak) IBOutlet NSTextField *label_notRecoginitonArea_alpha; 57 | 58 | 59 | 60 | @end 61 | 62 | -------------------------------------------------------------------------------- /LBXScanUITool/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/12. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import "NSView+Extension.h" 12 | 13 | @implementation ViewController 14 | 15 | - (void)viewDidLoad { 16 | [super viewDidLoad]; 17 | 18 | // Do any additional setup after loading the view. 19 | 20 | self.title = @"LBXScan"; 21 | self.style = [self defaultStyle]; 22 | 23 | [self performSelector:@selector(drawScanView) withObject:nil afterDelay:0.3]; 24 | [self performSelector:@selector(delayInitUI) withObject:nil afterDelay:0.3]; 25 | 26 | } 27 | 28 | - (void)delayInitUI 29 | { 30 | //扫码框颜色 设置按钮 31 | [_colorPanel_colorRetangleLine setBackGroundColor:_style.colorRetangleLine]; 32 | _colorPanel_colorRetangleLine.transparent = YES; 33 | _colorPanel_colorRetangleLine.bordered = NO; 34 | 35 | //扫码框 4个角 设置按钮 36 | [_colorPanel_colorAngle setBackGroundColor:_style.colorAngle]; 37 | _colorPanel_colorAngle.transparent = YES; 38 | _colorPanel_colorAngle.bordered = NO; 39 | 40 | //非识别区颜色 41 | [_colorPanel_notRecoginitonArea setBackGroundColor:_style.notRecoginitonArea]; 42 | _colorPanel_notRecoginitonArea.transparent = YES; 43 | _colorPanel_notRecoginitonArea.bordered = NO; 44 | 45 | //相框角 选择list 46 | [_popUpButton_photoframeAngleStyle removeAllItems]; 47 | [_popUpButton_photoframeAngleStyle addItemWithTitle:@"Inner"]; 48 | [_popUpButton_photoframeAngleStyle addItemWithTitle:@"Outer"]; 49 | [_popUpButton_photoframeAngleStyle addItemWithTitle:@"On"]; 50 | [_popUpButton_photoframeAngleStyle addItemWithTitle:@"None"]; 51 | switch (_style.photoframeAngleStyle) { 52 | case LBXScanViewPhotoframeAngleStyle_Inner: 53 | [_popUpButton_photoframeAngleStyle selectItemAtIndex:0]; 54 | break; 55 | case LBXScanViewPhotoframeAngleStyle_Outer: 56 | [_popUpButton_photoframeAngleStyle selectItemAtIndex:1]; 57 | break; 58 | case LBXScanViewPhotoframeAngleStyle_On: 59 | [_popUpButton_photoframeAngleStyle selectItemAtIndex:2]; 60 | break; 61 | case LBXScanViewPhotoframeAngleStyle_None: 62 | [_popUpButton_photoframeAngleStyle selectItemAtIndex:3]; 63 | break; 64 | 65 | default: 66 | break; 67 | } 68 | 69 | [self loadParamenter2LabelShow]; 70 | } 71 | 72 | - (void)loadParamenter2LabelShow 73 | { 74 | //默认参数值显示 75 | _label_whRatio.stringValue = [NSString stringWithFormat:@"%.1f",_style.whRatio]; 76 | _label_centerUpOffset.stringValue = [NSString stringWithFormat:@"%d",(int)_style.centerUpOffset]; 77 | _label_xScanRetangleOffset.stringValue = [NSString stringWithFormat:@"%d",(int)_style.xScanRetangleOffset]; 78 | _label_colorRetangleLine.stringValue = [self stringFromColor:_style.colorRetangleLine]; 79 | _label_colorAngle.stringValue = [self stringFromColor:_style.colorAngle]; 80 | _label_photoframeAngleW.stringValue = [NSString stringWithFormat:@"%d",(int)_style.photoframeAngleW]; 81 | _label_photoframeAngleH.stringValue = [NSString stringWithFormat:@"%d",(int)_style.photoframeAngleH]; 82 | _label_photoframeLineW.stringValue = [NSString stringWithFormat:@"%d",(int)_style.photoframeLineW]; 83 | _label_notRecoginitonArea.stringValue = [self stringFromColor:_style.notRecoginitonArea]; 84 | _label_notRecoginitonArea_alpha.stringValue = [self stringAlphaFromColor:_style.notRecoginitonArea]; 85 | } 86 | 87 | - (NSString*)stringFromColor:(NSColor*)color 88 | { 89 | const CGFloat *components = CGColorGetComponents( color.CGColor); 90 | 91 | 92 | CGFloat red_notRecoginitonArea = components[0]; 93 | CGFloat green_notRecoginitonArea = components[1]; 94 | CGFloat blue_notRecoginitonArea = components[2]; 95 | 96 | 97 | return [NSString stringWithFormat:@"RGB(%d,%d,%d)",(int)(red_notRecoginitonArea*255),(int)(green_notRecoginitonArea*255),(int)(blue_notRecoginitonArea*255)]; 98 | 99 | } 100 | 101 | - (NSString*)stringAlphaFromColor:(NSColor*)color 102 | { 103 | const CGFloat *components = CGColorGetComponents( color.CGColor); 104 | CGFloat alpha_notRecoginitonArea = components[3]; 105 | return [NSString stringWithFormat:@"%.1f",alpha_notRecoginitonArea]; 106 | } 107 | 108 | 109 | //是否显示扫码框 110 | - (IBAction)checkBoxAction_isNeedShowRetangle:(id)sender { 111 | 112 | NSLog(@"%ld",_checkBox_isNeedShowRetangle.state); 113 | 114 | _style.isNeedShowRetangle = _checkBox_isNeedShowRetangle.state; 115 | 116 | [_scanView setNeedsDisplay:YES]; 117 | } 118 | 119 | 120 | //打开颜色面板 121 | - (IBAction)openColorPanel:(id)sender 122 | { 123 | self.preButton = sender; 124 | 125 | NSColorPanel *colorpanel = [NSColorPanel sharedColorPanel]; 126 | colorpanel.mode = NSColorPanelModeRGB; 127 | [colorpanel setAction:@selector(changeColor:)]; 128 | [colorpanel setTarget:self]; 129 | 130 | //初始化面板颜色 131 | if (_preButton == _colorPanel_colorRetangleLine) { 132 | colorpanel.color = _style.colorRetangleLine; 133 | } 134 | else if (_preButton == _colorPanel_colorAngle){ 135 | colorpanel.color = _style.colorAngle; 136 | } 137 | else if (_preButton == _colorPanel_notRecoginitonArea) 138 | { 139 | colorpanel.color = _style.notRecoginitonArea; 140 | } 141 | 142 | 143 | [colorpanel orderFront:_checkBox_isNeedShowRetangle]; 144 | 145 | } 146 | 147 | - (void)changeColor:(id)sender { 148 | NSColorPanel *colorPanel = sender ; 149 | NSColor* panelColor = colorPanel.color; 150 | 151 | NSLog(@"%@",panelColor); 152 | 153 | if (_preButton == _colorPanel_colorRetangleLine) { 154 | 155 | [_colorPanel_colorRetangleLine setBackGroundColor:panelColor]; 156 | 157 | //扫码框颜色 158 | _style.colorRetangleLine = panelColor; 159 | 160 | } 161 | else if (_preButton == _colorPanel_colorAngle) 162 | { 163 | 164 | [_colorPanel_colorAngle setBackGroundColor:panelColor]; 165 | 166 | //扫码框4个角颜色 167 | _style.colorAngle = panelColor; 168 | 169 | } 170 | else if (_preButton == _colorPanel_notRecoginitonArea) 171 | { 172 | [_colorPanel_notRecoginitonArea setBackGroundColor:panelColor]; 173 | const CGFloat *components = CGColorGetComponents(panelColor.CGColor); 174 | 175 | 176 | CGFloat red_notRecoginitonArea = components[0]; 177 | CGFloat green_notRecoginitonArea = components[1]; 178 | CGFloat blue_notRecoginitonArea = components[2]; 179 | // CGFloat alpa_notRecoginitonArea = components[3]; 180 | 181 | NSColor *color = [NSColor colorWithRed:red_notRecoginitonArea green:green_notRecoginitonArea blue:blue_notRecoginitonArea alpha:0.5]; 182 | 183 | _style.notRecoginitonArea = color; 184 | } 185 | 186 | [self loadParamenter2LabelShow]; 187 | 188 | [_scanView setNeedsDisplay:YES]; 189 | 190 | } 191 | 192 | 193 | - (IBAction)sliderAction:(id)sender { 194 | 195 | 196 | _label_whRatio.stringValue = [NSString stringWithFormat:@"%.1f",_style.whRatio]; 197 | _label_centerUpOffset.stringValue = [NSString stringWithFormat:@"%d",(int)_style.centerUpOffset]; 198 | _label_xScanRetangleOffset.stringValue = [NSString stringWithFormat:@"%d",(int)_style.xScanRetangleOffset]; 199 | _label_colorRetangleLine.stringValue = [self stringFromColor:_style.colorRetangleLine]; 200 | _label_colorAngle.stringValue = [self stringFromColor:_style.colorAngle]; 201 | _label_photoframeAngleW.stringValue = [NSString stringWithFormat:@"%d",(int)_style.photoframeAngleW]; 202 | _label_photoframeAngleH.stringValue = [NSString stringWithFormat:@"%d",(int)_style.photoframeAngleH]; 203 | _label_photoframeLineW.stringValue = [NSString stringWithFormat:@"%d",(int)_style.photoframeLineW]; 204 | _label_notRecoginitonArea.stringValue = [self stringFromColor:_style.notRecoginitonArea]; 205 | _label_notRecoginitonArea_alpha.stringValue = [self stringAlphaFromColor:_style.notRecoginitonArea]; 206 | 207 | if (sender == _slider_wRation) { 208 | NSLog(@"%f", _slider_wRation.doubleValue); 209 | //0---200 范围 类比到 0.0 --- 2.0 210 | double wRation = _slider_wRation.doubleValue / 100.0; 211 | _style.whRatio = wRation; 212 | } 213 | else if (sender == _slider_centerUpOffset) 214 | { 215 | NSLog(@"%ld", _slider_centerUpOffset.integerValue); 216 | _style.centerUpOffset = _slider_centerUpOffset.integerValue; 217 | } 218 | else if (sender == _slider_xScanRetangleOffset) 219 | { 220 | _style.xScanRetangleOffset = _slider_xScanRetangleOffset.integerValue; 221 | } 222 | else if (sender == _slider_photoframeAngleW) 223 | { 224 | _style.photoframeAngleW = _slider_photoframeAngleW.integerValue; 225 | } 226 | else if (sender == _slider_photoframeAngleH) 227 | { 228 | _style.photoframeAngleH = _slider_photoframeAngleH.integerValue; 229 | } 230 | else if (sender == _slider_photoframeAngleH) 231 | { 232 | _style.photoframeAngleH = _slider_photoframeAngleH.integerValue; 233 | } 234 | else if (sender == _slider_photoframeLineW) 235 | { 236 | _style.photoframeLineW = _slider_photoframeLineW.integerValue; 237 | } 238 | else if (sender == _slider_notRecoginitonArea_Alpa) 239 | { 240 | const CGFloat *components = CGColorGetComponents( _style.notRecoginitonArea.CGColor); 241 | 242 | 243 | CGFloat red_notRecoginitonArea = components[0]; 244 | CGFloat green_notRecoginitonArea = components[1]; 245 | CGFloat blue_notRecoginitonArea = components[2]; 246 | // CGFloat alpa_notRecoginitonArea = components[3]; 247 | 248 | CGFloat alpha = _slider_notRecoginitonArea_Alpa.integerValue / 100.0; 249 | 250 | NSColor *color = [NSColor colorWithRed:red_notRecoginitonArea green:green_notRecoginitonArea blue:blue_notRecoginitonArea alpha:alpha]; 251 | 252 | _style.notRecoginitonArea = color; 253 | 254 | [_scanView setNeedsDisplay:YES]; 255 | 256 | } 257 | 258 | [self loadParamenter2LabelShow]; 259 | 260 | [_scanView setNeedsDisplay:YES]; 261 | 262 | } 263 | - (IBAction)popUpButtonAction:(id)sender { 264 | 265 | if (sender == _popUpButton_photoframeAngleStyle) { 266 | 267 | switch (_popUpButton_photoframeAngleStyle.indexOfSelectedItem) { 268 | case 0: 269 | _style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Inner; 270 | break; 271 | case 1: 272 | _style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Outer; 273 | break; 274 | case 2: 275 | _style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_On; 276 | break; 277 | case 3: 278 | _style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_None; 279 | break; 280 | default: 281 | break; 282 | } 283 | [_scanView setNeedsDisplay:YES]; 284 | } 285 | } 286 | 287 | 288 | #pragma mark ---- 绘制扫码区域 ----- 289 | 290 | - (void)drawScanView 291 | { 292 | CGRect frame = _iphoneView.frame; 293 | frame.origin = CGPointMake(0, 0); 294 | 295 | 296 | //添加标题 "扫一扫" 297 | CGRect frame1 = frame; 298 | frame1.origin.y += 14; 299 | frame1.size.height -= 14; 300 | NSTextField *titleLabel = [[NSTextField alloc]initWithFrame:frame1]; 301 | titleLabel.stringValue = @"扫一扫"; 302 | titleLabel.textColor = [NSColor whiteColor]; 303 | titleLabel.font = [NSFont systemFontOfSize:16]; 304 | titleLabel.alignment = NSTextAlignmentCenter; 305 | titleLabel.backgroundColor = [NSColor colorWithRed:53/255. green:143/255. blue:231/255. alpha:1.]; 306 | // 不设置会导致背景颜色去不掉 307 | titleLabel.bordered = NO; 308 | 309 | [titleLabel setEditable:NO]; 310 | // 设置为禁用, 就不能点击到text ,就不会出现蓝色的边框,设置静态文本时一定要设置这个属性 311 | [titleLabel setEnabled:NO]; 312 | 313 | [_iphoneView addSubview:titleLabel]; 314 | 315 | 316 | //模拟相机界面 317 | frame.origin.y += 44; 318 | frame.size.height -= 44; 319 | NSImageView *imgView = [[NSImageView alloc]initWithFrame:frame]; 320 | imgView.image= [NSImage imageNamed:@"backImg"]; 321 | imgView.imageScaling = NSImageScaleAxesIndependently; 322 | [_iphoneView addSubview:imgView]; 323 | 324 | //添加扫码效果 325 | frame = _iphoneView.frame; 326 | frame.origin = CGPointMake(0, 44); 327 | frame.size.height -= 44; 328 | LBXScanView * scanview = [[LBXScanView alloc]initWithFrame:frame style:_style]; 329 | [_iphoneView addSubview:scanview]; 330 | 331 | [_iphoneView setBackGroundColor:[NSColor colorWithRed:53/255. green:143/255. blue:231/255. alpha:1.]]; 332 | 333 | self.scanView = scanview; 334 | 335 | // [_scanView startScanAnimation]; 336 | } 337 | 338 | #pragma mark -模仿qq界面 339 | - (LBXScanViewStyle*)defaultStyle 340 | { 341 | //设置扫码区域参数设置 342 | 343 | //创建参数对象 344 | LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init]; 345 | 346 | //矩形区域中心上移,默认中心点为屏幕中心点 347 | style.centerUpOffset = 44; 348 | 349 | //扫码框周围4个角的类型,设置为外挂式 350 | style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Outer; 351 | 352 | //扫码框周围4个角绘制的线条宽度 353 | style.photoframeLineW = 6; 354 | 355 | //扫码框周围4个角的宽度 356 | style.photoframeAngleW = 24; 357 | 358 | //扫码框周围4个角的高度 359 | style.photoframeAngleH = 24; 360 | 361 | //扫码框内 动画类型 --线条上下移动 362 | style.anmiationStyle = LBXScanViewAnimationStyle_LineMove; 363 | 364 | style.colorRetangleLine = [NSColor colorWithRed:0 green:0 blue:1 alpha:1.]; 365 | 366 | //线条上下移动图片 367 | style.animationImage = [NSImage imageNamed:@"qrcode_scan_light_green"]; 368 | 369 | return style; 370 | } 371 | 372 | 373 | 374 | - (void)setRepresentedObject:(id)representedObject { 375 | [super setRepresentedObject:representedObject]; 376 | 377 | // Update the view, if already loaded. 378 | } 379 | 380 | 381 | @end 382 | -------------------------------------------------------------------------------- /LBXScanUITool/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LBXScanUITool 4 | // 5 | // Created by lbxia on 2017/6/12. 6 | // Copyright © 2017年 lbx. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LBXScanUITool 2 | 3 | 4 | [LBXScan](https://github.com/MxABC/LBXScan)和([swiftscan](https://github.com/MxABC/swiftScan))扫码界面DIY工具及辅助对参数的理解 5 | 6 | LBXScanViewStyle 界面参数,通过mac app展示出来,通过界面上的操作,方便大家理解及找到自己需要的参数值。 7 | 8 | 请看工具gif图 9 | 10 | ![image](https://github.com/MxABC/Resource/blob/master/LBXScanUITool.gif) 11 | 12 | *** 13 | 定义代码 14 | 15 | ``` 16 | @interface LBXScanViewStyle : NSObject 17 | 18 | 19 | #pragma mark -中心位置矩形框 20 | /** 21 | @brief 是否需要绘制扫码矩形框,默认YES 22 | */ 23 | @property (nonatomic, assign) BOOL isNeedShowRetangle; 24 | 25 | 26 | /** 27 | * 默认扫码区域为正方形,如果扫码区域不是正方形,设置宽高比 28 | */ 29 | @property (nonatomic, assign) CGFloat whRatio; 30 | 31 | 32 | /** 33 | @brief 矩形框(视频显示透明区)域向上移动偏移量,0表示扫码透明区域在当前视图中心位置,< 0 表示扫码区域下移, >0 表示扫码区域上移 34 | */ 35 | @property (nonatomic, assign) CGFloat centerUpOffset; 36 | 37 | /** 38 | * 矩形框(视频显示透明区)域离界面左边及右边距离,默认60 39 | */ 40 | @property (nonatomic, assign) CGFloat xScanRetangleOffset; 41 | 42 | /** 43 | @brief 矩形框线条颜色 44 | */ 45 | @property (nonatomic, strong) NSColor *colorRetangleLine; 46 | 47 | 48 | 49 | #pragma mark -矩形框(扫码区域)周围4个角 50 | /** 51 | @brief 扫码区域的4个角类型 52 | */ 53 | @property (nonatomic, assign) LBXScanViewPhotoframeAngleStyle photoframeAngleStyle; 54 | 55 | //4个角的颜色 56 | @property (nonatomic, strong) NSColor* colorAngle; 57 | 58 | //扫码区域4个角的宽度和高度 59 | @property (nonatomic, assign) CGFloat photoframeAngleW; 60 | @property (nonatomic, assign) CGFloat photoframeAngleH; 61 | /** 62 | @brief 扫码区域4个角的线条宽度,默认6,建议8到4之间 63 | */ 64 | @property (nonatomic, assign) CGFloat photoframeLineW; 65 | 66 | 67 | 68 | 69 | #pragma mark --动画效果 70 | /** 71 | @brief 扫码动画效果:线条或网格 72 | */ 73 | @property (nonatomic, assign) LBXScanViewAnimationStyle anmiationStyle; 74 | 75 | /** 76 | * 动画效果的图像,如线条或网格的图像,如果为nil,表示不需要动画效果 77 | */ 78 | @property (nonatomic,strong,nullable) NSImage *animationImage; 79 | 80 | 81 | 82 | #pragma mark -非识别区域颜色,默认 RGBA (0,0,0,0.5) 83 | 84 | /** 85 | must be create by [UIColor colorWithRed: green: blue: alpha:] 86 | */ 87 | //notRecognitionArea 88 | @property (nonatomic, strong) NSColor *notRecoginitonArea; 89 | 90 | 91 | @end 92 | 93 | ``` 94 | 95 | *** 96 | 调用代码 97 | 98 | ```obj-c 99 | - (LBXScanViewStyle*)DIY 100 | { 101 | //设置扫码区域参数 102 | LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init]; 103 | 104 | //扫码框中心位置与View中心位置上移偏移像素(一般扫码框在视图中心位置上方一点) 105 | style.centerUpOffset = 44; 106 | 107 | 108 | 109 | //扫码框周围4个角的类型设置为在框的上面,可自行修改查看效果 110 | style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_On; 111 | 112 | //扫码框周围4个角绘制线段宽度 113 | style.photoframeLineW = 6; 114 | 115 | //扫码框周围4个角水平长度 116 | style.photoframeAngleW = 24; 117 | 118 | //扫码框周围4个角垂直高度 119 | style.photoframeAngleH = 24; 120 | 121 | 122 | //动画类型:网格形式,模仿支付宝 123 | style.anmiationStyle = LBXScanViewAnimationStyle_NetGrid; 124 | 125 | //动画图片:网格图片 126 | style.animationImage = [UIImage imageNamed:@"CodeScan.bundle/qrcode_scan_part_net"];; 127 | 128 | //扫码框周围4个角的颜色 129 | style.colorAngle = [UIColor colorWithRed:65./255. green:174./255. blue:57./255. alpha:1.0]; 130 | 131 | //是否显示扫码框 132 | style.isNeedShowRetangle = YES; 133 | //扫码框颜色 134 | style.colorRetangleLine = [UIColor colorWithRed:247/255. green:202./255. blue:15./255. alpha:1.0]; 135 | 136 | //非扫码框区域颜色(扫码框周围颜色,一般颜色略暗) 137 | //必须通过[UIColor colorWithRed: green: blue: alpha:]来创建,内部需要解析成RGBA 138 | style.notRecoginitonArea = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6]; 139 | 140 | return style; 141 | } 142 | ``` 143 | --------------------------------------------------------------------------------