├── .DS_Store.r905 ├── .DS_Store.r911 ├── PrinterDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ ├── PrinterDemo.xccheckout │ │ └── PrinterDemo.xcscmblueprint │ └── xcuserdata │ │ ├── chenbotao.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── wuyiqi.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ ├── UserInterfaceState.xcuserstate.r905 │ │ ├── UserInterfaceState.xcuserstate.r911 │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ ├── chenbotao.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── PrinterDemo.xcscheme │ │ └── xcschememanagement.plist │ └── wuyiqi.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── PrinterDemo.xcscheme │ └── xcschememanagement.plist ├── PrinterDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── HJPrinterDemoViewController.h ├── HJPrinterDemoViewController.m ├── HJPrinterDemoViewController.xib ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── ico144.imageset │ │ ├── Contents.json │ │ └── ico144.png ├── Info.plist ├── PgyUpdate │ └── PgySDK │ │ └── sdk │ │ └── PgyUpdate.framework │ │ ├── Headers │ │ └── PgyUpdateManager.h │ │ ├── Info.plist │ │ ├── PgyUpdate │ │ ├── Resources │ │ └── Versions │ │ ├── A │ │ ├── Headers │ │ │ └── PgyUpdateManager.h │ │ └── PgyUpdate │ │ └── Current ├── PrinterDemo.xcdatamodeld │ ├── .xccurrentversion │ └── PrinterDemo.xcdatamodel │ │ └── contents ├── PrinterSDK.h ├── SVProgressHD │ ├── SVProgressHUD.bundle │ │ ├── error.png │ │ ├── error@2x.png │ │ ├── success.png │ │ └── success@2x.png │ ├── SVProgressHUD.h │ └── SVProgressHUD.m ├── ViewController.h ├── ViewController.m ├── ico180.png ├── libPrinterSDK.a ├── main.m └── setting │ ├── FormatSettingTableViewController.h │ ├── FormatSettingTableViewController.m │ ├── PrinterListViewController.h │ ├── PrinterListViewController.m │ ├── ValueEditViewController.h │ └── ValueEditViewController.m └── PrinterDemoTests ├── Info.plist └── PrinterDemoTests.m /.DS_Store.r905: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/.DS_Store.r905 -------------------------------------------------------------------------------- /.DS_Store.r911: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/.DS_Store.r911 -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E105C9A61BA7C88100265142 /* HJPrinterDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E105C9A41BA7C88100265142 /* HJPrinterDemoViewController.m */; }; 11 | E105C9A71BA7C88100265142 /* HJPrinterDemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E105C9A51BA7C88100265142 /* HJPrinterDemoViewController.xib */; }; 12 | E13FA8AE1C96F0D000BA03C9 /* libPrinterSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E13FA8AD1C96F0D000BA03C9 /* libPrinterSDK.a */; }; 13 | E13FA8B51C96F30300BA03C9 /* libxml2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E13FA8B41C96F30300BA03C9 /* libxml2.tbd */; }; 14 | E13FA8B71C96F32000BA03C9 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E13FA8B61C96F32000BA03C9 /* MobileCoreServices.framework */; }; 15 | E13FA8B91C96F33600BA03C9 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E13FA8B81C96F33600BA03C9 /* libz.tbd */; }; 16 | E13FA8BA1C96F34000BA03C9 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E13FA8B01C96F2B900BA03C9 /* SystemConfiguration.framework */; }; 17 | E13FA8BB1C96F34700BA03C9 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E13FA8B21C96F2F900BA03C9 /* CFNetwork.framework */; }; 18 | E13FA8BD1C96F36300BA03C9 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E13FA8BC1C96F36300BA03C9 /* AVFoundation.framework */; }; 19 | E1AA88C31C75CAE300FD3450 /* FormatSettingTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1AA88BE1C75CAE300FD3450 /* FormatSettingTableViewController.m */; }; 20 | E1AA88C41C75CAE300FD3450 /* PrinterListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1AA88C01C75CAE300FD3450 /* PrinterListViewController.m */; }; 21 | E1AA88C51C75CAE300FD3450 /* ValueEditViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1AA88C21C75CAE300FD3450 /* ValueEditViewController.m */; }; 22 | E1B62D481BE4746C00E00E2C /* PgyUpdate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1B62D471BE4746C00E00E2C /* PgyUpdate.framework */; }; 23 | E1DC34F31C4920BA0089C3DF /* ico180.png in Resources */ = {isa = PBXBuildFile; fileRef = E1DC34F21C4920BA0089C3DF /* ico180.png */; }; 24 | E1F478F71BA7030B00702420 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E1F478F61BA7030B00702420 /* main.m */; }; 25 | E1F478FA1BA7030B00702420 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E1F478F91BA7030B00702420 /* AppDelegate.m */; }; 26 | E1F478FD1BA7030B00702420 /* PrinterDemo.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = E1F478FB1BA7030B00702420 /* PrinterDemo.xcdatamodeld */; }; 27 | E1F479001BA7030B00702420 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1F478FF1BA7030B00702420 /* ViewController.m */; }; 28 | E1F479031BA7030B00702420 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E1F479011BA7030B00702420 /* Main.storyboard */; }; 29 | E1F479051BA7030B00702420 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E1F479041BA7030B00702420 /* Images.xcassets */; }; 30 | E1F479081BA7030B00702420 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E1F479061BA7030B00702420 /* LaunchScreen.xib */; }; 31 | E1F479141BA7030B00702420 /* PrinterDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E1F479131BA7030B00702420 /* PrinterDemoTests.m */; }; 32 | E1F9ABCC1BA95779001BCB0D /* SVProgressHUD.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E1F9ABC91BA95779001BCB0D /* SVProgressHUD.bundle */; }; 33 | E1F9ABCD1BA95779001BCB0D /* SVProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = E1F9ABCB1BA95779001BCB0D /* SVProgressHUD.m */; }; 34 | /* End PBXBuildFile section */ 35 | 36 | /* Begin PBXContainerItemProxy section */ 37 | E1F4790E1BA7030B00702420 /* PBXContainerItemProxy */ = { 38 | isa = PBXContainerItemProxy; 39 | containerPortal = E1F478E91BA7030B00702420 /* Project object */; 40 | proxyType = 1; 41 | remoteGlobalIDString = E1F478F01BA7030B00702420; 42 | remoteInfo = PrinterDemo; 43 | }; 44 | /* End PBXContainerItemProxy section */ 45 | 46 | /* Begin PBXCopyFilesBuildPhase section */ 47 | E1D7F4211BA9A92800461CD2 /* Embed Frameworks */ = { 48 | isa = PBXCopyFilesBuildPhase; 49 | buildActionMask = 2147483647; 50 | dstPath = ""; 51 | dstSubfolderSpec = 10; 52 | files = ( 53 | ); 54 | name = "Embed Frameworks"; 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXCopyFilesBuildPhase section */ 58 | 59 | /* Begin PBXFileReference section */ 60 | E105C9A31BA7C88100265142 /* HJPrinterDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HJPrinterDemoViewController.h; sourceTree = ""; }; 61 | E105C9A41BA7C88100265142 /* HJPrinterDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HJPrinterDemoViewController.m; sourceTree = ""; }; 62 | E105C9A51BA7C88100265142 /* HJPrinterDemoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HJPrinterDemoViewController.xib; sourceTree = ""; }; 63 | E13FA8AD1C96F0D000BA03C9 /* libPrinterSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libPrinterSDK.a; sourceTree = ""; }; 64 | E13FA8AF1C96F10800BA03C9 /* PrinterSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrinterSDK.h; sourceTree = ""; }; 65 | E13FA8B01C96F2B900BA03C9 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 66 | E13FA8B21C96F2F900BA03C9 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; 67 | E13FA8B41C96F30300BA03C9 /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = usr/lib/libxml2.tbd; sourceTree = SDKROOT; }; 68 | E13FA8B61C96F32000BA03C9 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; 69 | E13FA8B81C96F33600BA03C9 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 70 | E13FA8BC1C96F36300BA03C9 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 71 | E1AA88BD1C75CAE300FD3450 /* FormatSettingTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatSettingTableViewController.h; sourceTree = ""; }; 72 | E1AA88BE1C75CAE300FD3450 /* FormatSettingTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FormatSettingTableViewController.m; sourceTree = ""; }; 73 | E1AA88BF1C75CAE300FD3450 /* PrinterListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrinterListViewController.h; sourceTree = ""; }; 74 | E1AA88C01C75CAE300FD3450 /* PrinterListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrinterListViewController.m; sourceTree = ""; }; 75 | E1AA88C11C75CAE300FD3450 /* ValueEditViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueEditViewController.h; sourceTree = ""; }; 76 | E1AA88C21C75CAE300FD3450 /* ValueEditViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ValueEditViewController.m; sourceTree = ""; }; 77 | E1B62D471BE4746C00E00E2C /* PgyUpdate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PgyUpdate.framework; sourceTree = ""; }; 78 | E1DC34F21C4920BA0089C3DF /* ico180.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ico180.png; sourceTree = ""; }; 79 | E1F478F11BA7030B00702420 /* PrinterDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PrinterDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 80 | E1F478F51BA7030B00702420 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 81 | E1F478F61BA7030B00702420 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 82 | E1F478F81BA7030B00702420 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 83 | E1F478F91BA7030B00702420 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 84 | E1F478FC1BA7030B00702420 /* PrinterDemo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = PrinterDemo.xcdatamodel; sourceTree = ""; }; 85 | E1F478FE1BA7030B00702420 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 86 | E1F478FF1BA7030B00702420 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 87 | E1F479021BA7030B00702420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 88 | E1F479041BA7030B00702420 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 89 | E1F479071BA7030B00702420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 90 | E1F4790D1BA7030B00702420 /* PrinterDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PrinterDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 91 | E1F479121BA7030B00702420 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 92 | E1F479131BA7030B00702420 /* PrinterDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrinterDemoTests.m; sourceTree = ""; }; 93 | E1F9ABC91BA95779001BCB0D /* SVProgressHUD.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SVProgressHUD.bundle; sourceTree = ""; }; 94 | E1F9ABCA1BA95779001BCB0D /* SVProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVProgressHUD.h; sourceTree = ""; }; 95 | E1F9ABCB1BA95779001BCB0D /* SVProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVProgressHUD.m; sourceTree = ""; }; 96 | /* End PBXFileReference section */ 97 | 98 | /* Begin PBXFrameworksBuildPhase section */ 99 | E1F478EE1BA7030B00702420 /* Frameworks */ = { 100 | isa = PBXFrameworksBuildPhase; 101 | buildActionMask = 2147483647; 102 | files = ( 103 | E13FA8BD1C96F36300BA03C9 /* AVFoundation.framework in Frameworks */, 104 | E13FA8BB1C96F34700BA03C9 /* CFNetwork.framework in Frameworks */, 105 | E13FA8BA1C96F34000BA03C9 /* SystemConfiguration.framework in Frameworks */, 106 | E13FA8B91C96F33600BA03C9 /* libz.tbd in Frameworks */, 107 | E13FA8B71C96F32000BA03C9 /* MobileCoreServices.framework in Frameworks */, 108 | E13FA8B51C96F30300BA03C9 /* libxml2.tbd in Frameworks */, 109 | E1B62D481BE4746C00E00E2C /* PgyUpdate.framework in Frameworks */, 110 | E13FA8AE1C96F0D000BA03C9 /* libPrinterSDK.a in Frameworks */, 111 | ); 112 | runOnlyForDeploymentPostprocessing = 0; 113 | }; 114 | E1F4790A1BA7030B00702420 /* Frameworks */ = { 115 | isa = PBXFrameworksBuildPhase; 116 | buildActionMask = 2147483647; 117 | files = ( 118 | ); 119 | runOnlyForDeploymentPostprocessing = 0; 120 | }; 121 | /* End PBXFrameworksBuildPhase section */ 122 | 123 | /* Begin PBXGroup section */ 124 | E1AA88BC1C75CAE300FD3450 /* setting */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | E1AA88BD1C75CAE300FD3450 /* FormatSettingTableViewController.h */, 128 | E1AA88BE1C75CAE300FD3450 /* FormatSettingTableViewController.m */, 129 | E1AA88BF1C75CAE300FD3450 /* PrinterListViewController.h */, 130 | E1AA88C01C75CAE300FD3450 /* PrinterListViewController.m */, 131 | E1AA88C11C75CAE300FD3450 /* ValueEditViewController.h */, 132 | E1AA88C21C75CAE300FD3450 /* ValueEditViewController.m */, 133 | ); 134 | path = setting; 135 | sourceTree = ""; 136 | }; 137 | E1B62D441BE4746C00E00E2C /* PgyUpdate */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | E1B62D451BE4746C00E00E2C /* PgySDK */, 141 | ); 142 | path = PgyUpdate; 143 | sourceTree = ""; 144 | }; 145 | E1B62D451BE4746C00E00E2C /* PgySDK */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | E1B62D461BE4746C00E00E2C /* sdk */, 149 | ); 150 | path = PgySDK; 151 | sourceTree = ""; 152 | }; 153 | E1B62D461BE4746C00E00E2C /* sdk */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | E1B62D471BE4746C00E00E2C /* PgyUpdate.framework */, 157 | ); 158 | path = sdk; 159 | sourceTree = ""; 160 | }; 161 | E1F478E81BA7030B00702420 = { 162 | isa = PBXGroup; 163 | children = ( 164 | E13FA8BC1C96F36300BA03C9 /* AVFoundation.framework */, 165 | E13FA8B81C96F33600BA03C9 /* libz.tbd */, 166 | E13FA8B61C96F32000BA03C9 /* MobileCoreServices.framework */, 167 | E13FA8B41C96F30300BA03C9 /* libxml2.tbd */, 168 | E13FA8B21C96F2F900BA03C9 /* CFNetwork.framework */, 169 | E13FA8B01C96F2B900BA03C9 /* SystemConfiguration.framework */, 170 | E1F478F31BA7030B00702420 /* PrinterDemo */, 171 | E1F479101BA7030B00702420 /* PrinterDemoTests */, 172 | E1F478F21BA7030B00702420 /* Products */, 173 | ); 174 | sourceTree = ""; 175 | }; 176 | E1F478F21BA7030B00702420 /* Products */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | E1F478F11BA7030B00702420 /* PrinterDemo.app */, 180 | E1F4790D1BA7030B00702420 /* PrinterDemoTests.xctest */, 181 | ); 182 | name = Products; 183 | sourceTree = ""; 184 | }; 185 | E1F478F31BA7030B00702420 /* PrinterDemo */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | E13FA8AF1C96F10800BA03C9 /* PrinterSDK.h */, 189 | E13FA8AD1C96F0D000BA03C9 /* libPrinterSDK.a */, 190 | E1AA88BC1C75CAE300FD3450 /* setting */, 191 | E1DC34F21C4920BA0089C3DF /* ico180.png */, 192 | E1B62D441BE4746C00E00E2C /* PgyUpdate */, 193 | E1F9ABC81BA95779001BCB0D /* SVProgressHD */, 194 | E1F478F81BA7030B00702420 /* AppDelegate.h */, 195 | E1F478F91BA7030B00702420 /* AppDelegate.m */, 196 | E105C9A31BA7C88100265142 /* HJPrinterDemoViewController.h */, 197 | E105C9A41BA7C88100265142 /* HJPrinterDemoViewController.m */, 198 | E105C9A51BA7C88100265142 /* HJPrinterDemoViewController.xib */, 199 | E1F478FE1BA7030B00702420 /* ViewController.h */, 200 | E1F478FF1BA7030B00702420 /* ViewController.m */, 201 | E1F479011BA7030B00702420 /* Main.storyboard */, 202 | E1F479041BA7030B00702420 /* Images.xcassets */, 203 | E1F479061BA7030B00702420 /* LaunchScreen.xib */, 204 | E1F478FB1BA7030B00702420 /* PrinterDemo.xcdatamodeld */, 205 | E1F478F41BA7030B00702420 /* Supporting Files */, 206 | ); 207 | path = PrinterDemo; 208 | sourceTree = ""; 209 | }; 210 | E1F478F41BA7030B00702420 /* Supporting Files */ = { 211 | isa = PBXGroup; 212 | children = ( 213 | E1F478F51BA7030B00702420 /* Info.plist */, 214 | E1F478F61BA7030B00702420 /* main.m */, 215 | ); 216 | name = "Supporting Files"; 217 | sourceTree = ""; 218 | }; 219 | E1F479101BA7030B00702420 /* PrinterDemoTests */ = { 220 | isa = PBXGroup; 221 | children = ( 222 | E1F479131BA7030B00702420 /* PrinterDemoTests.m */, 223 | E1F479111BA7030B00702420 /* Supporting Files */, 224 | ); 225 | path = PrinterDemoTests; 226 | sourceTree = ""; 227 | }; 228 | E1F479111BA7030B00702420 /* Supporting Files */ = { 229 | isa = PBXGroup; 230 | children = ( 231 | E1F479121BA7030B00702420 /* Info.plist */, 232 | ); 233 | name = "Supporting Files"; 234 | sourceTree = ""; 235 | }; 236 | E1F9ABC81BA95779001BCB0D /* SVProgressHD */ = { 237 | isa = PBXGroup; 238 | children = ( 239 | E1F9ABC91BA95779001BCB0D /* SVProgressHUD.bundle */, 240 | E1F9ABCA1BA95779001BCB0D /* SVProgressHUD.h */, 241 | E1F9ABCB1BA95779001BCB0D /* SVProgressHUD.m */, 242 | ); 243 | path = SVProgressHD; 244 | sourceTree = ""; 245 | }; 246 | /* End PBXGroup section */ 247 | 248 | /* Begin PBXNativeTarget section */ 249 | E1F478F01BA7030B00702420 /* PrinterDemo */ = { 250 | isa = PBXNativeTarget; 251 | buildConfigurationList = E1F479171BA7030B00702420 /* Build configuration list for PBXNativeTarget "PrinterDemo" */; 252 | buildPhases = ( 253 | E1F478ED1BA7030B00702420 /* Sources */, 254 | E1F478EE1BA7030B00702420 /* Frameworks */, 255 | E1F478EF1BA7030B00702420 /* Resources */, 256 | E1D7F4211BA9A92800461CD2 /* Embed Frameworks */, 257 | ); 258 | buildRules = ( 259 | ); 260 | dependencies = ( 261 | ); 262 | name = PrinterDemo; 263 | productName = PrinterDemo; 264 | productReference = E1F478F11BA7030B00702420 /* PrinterDemo.app */; 265 | productType = "com.apple.product-type.application"; 266 | }; 267 | E1F4790C1BA7030B00702420 /* PrinterDemoTests */ = { 268 | isa = PBXNativeTarget; 269 | buildConfigurationList = E1F4791A1BA7030B00702420 /* Build configuration list for PBXNativeTarget "PrinterDemoTests" */; 270 | buildPhases = ( 271 | E1F479091BA7030B00702420 /* Sources */, 272 | E1F4790A1BA7030B00702420 /* Frameworks */, 273 | E1F4790B1BA7030B00702420 /* Resources */, 274 | ); 275 | buildRules = ( 276 | ); 277 | dependencies = ( 278 | E1F4790F1BA7030B00702420 /* PBXTargetDependency */, 279 | ); 280 | name = PrinterDemoTests; 281 | productName = PrinterDemoTests; 282 | productReference = E1F4790D1BA7030B00702420 /* PrinterDemoTests.xctest */; 283 | productType = "com.apple.product-type.bundle.unit-test"; 284 | }; 285 | /* End PBXNativeTarget section */ 286 | 287 | /* Begin PBXProject section */ 288 | E1F478E91BA7030B00702420 /* Project object */ = { 289 | isa = PBXProject; 290 | attributes = { 291 | LastUpgradeCheck = 0640; 292 | ORGANIZATIONNAME = com.cmcc; 293 | TargetAttributes = { 294 | E1F478F01BA7030B00702420 = { 295 | CreatedOnToolsVersion = 6.4; 296 | DevelopmentTeam = 56N39S7A6L; 297 | }; 298 | E1F4790C1BA7030B00702420 = { 299 | CreatedOnToolsVersion = 6.4; 300 | TestTargetID = E1F478F01BA7030B00702420; 301 | }; 302 | }; 303 | }; 304 | buildConfigurationList = E1F478EC1BA7030B00702420 /* Build configuration list for PBXProject "PrinterDemo" */; 305 | compatibilityVersion = "Xcode 3.2"; 306 | developmentRegion = English; 307 | hasScannedForEncodings = 0; 308 | knownRegions = ( 309 | en, 310 | Base, 311 | ); 312 | mainGroup = E1F478E81BA7030B00702420; 313 | productRefGroup = E1F478F21BA7030B00702420 /* Products */; 314 | projectDirPath = ""; 315 | projectRoot = ""; 316 | targets = ( 317 | E1F478F01BA7030B00702420 /* PrinterDemo */, 318 | E1F4790C1BA7030B00702420 /* PrinterDemoTests */, 319 | ); 320 | }; 321 | /* End PBXProject section */ 322 | 323 | /* Begin PBXResourcesBuildPhase section */ 324 | E1F478EF1BA7030B00702420 /* Resources */ = { 325 | isa = PBXResourcesBuildPhase; 326 | buildActionMask = 2147483647; 327 | files = ( 328 | E1F9ABCC1BA95779001BCB0D /* SVProgressHUD.bundle in Resources */, 329 | E105C9A71BA7C88100265142 /* HJPrinterDemoViewController.xib in Resources */, 330 | E1F479031BA7030B00702420 /* Main.storyboard in Resources */, 331 | E1F479081BA7030B00702420 /* LaunchScreen.xib in Resources */, 332 | E1F479051BA7030B00702420 /* Images.xcassets in Resources */, 333 | E1DC34F31C4920BA0089C3DF /* ico180.png in Resources */, 334 | ); 335 | runOnlyForDeploymentPostprocessing = 0; 336 | }; 337 | E1F4790B1BA7030B00702420 /* Resources */ = { 338 | isa = PBXResourcesBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | ); 342 | runOnlyForDeploymentPostprocessing = 0; 343 | }; 344 | /* End PBXResourcesBuildPhase section */ 345 | 346 | /* Begin PBXSourcesBuildPhase section */ 347 | E1F478ED1BA7030B00702420 /* Sources */ = { 348 | isa = PBXSourcesBuildPhase; 349 | buildActionMask = 2147483647; 350 | files = ( 351 | E1AA88C31C75CAE300FD3450 /* FormatSettingTableViewController.m in Sources */, 352 | E105C9A61BA7C88100265142 /* HJPrinterDemoViewController.m in Sources */, 353 | E1F478FA1BA7030B00702420 /* AppDelegate.m in Sources */, 354 | E1F9ABCD1BA95779001BCB0D /* SVProgressHUD.m in Sources */, 355 | E1F478FD1BA7030B00702420 /* PrinterDemo.xcdatamodeld in Sources */, 356 | E1AA88C41C75CAE300FD3450 /* PrinterListViewController.m in Sources */, 357 | E1F479001BA7030B00702420 /* ViewController.m in Sources */, 358 | E1AA88C51C75CAE300FD3450 /* ValueEditViewController.m in Sources */, 359 | E1F478F71BA7030B00702420 /* main.m in Sources */, 360 | ); 361 | runOnlyForDeploymentPostprocessing = 0; 362 | }; 363 | E1F479091BA7030B00702420 /* Sources */ = { 364 | isa = PBXSourcesBuildPhase; 365 | buildActionMask = 2147483647; 366 | files = ( 367 | E1F479141BA7030B00702420 /* PrinterDemoTests.m in Sources */, 368 | ); 369 | runOnlyForDeploymentPostprocessing = 0; 370 | }; 371 | /* End PBXSourcesBuildPhase section */ 372 | 373 | /* Begin PBXTargetDependency section */ 374 | E1F4790F1BA7030B00702420 /* PBXTargetDependency */ = { 375 | isa = PBXTargetDependency; 376 | target = E1F478F01BA7030B00702420 /* PrinterDemo */; 377 | targetProxy = E1F4790E1BA7030B00702420 /* PBXContainerItemProxy */; 378 | }; 379 | /* End PBXTargetDependency section */ 380 | 381 | /* Begin PBXVariantGroup section */ 382 | E1F479011BA7030B00702420 /* Main.storyboard */ = { 383 | isa = PBXVariantGroup; 384 | children = ( 385 | E1F479021BA7030B00702420 /* Base */, 386 | ); 387 | name = Main.storyboard; 388 | sourceTree = ""; 389 | }; 390 | E1F479061BA7030B00702420 /* LaunchScreen.xib */ = { 391 | isa = PBXVariantGroup; 392 | children = ( 393 | E1F479071BA7030B00702420 /* Base */, 394 | ); 395 | name = LaunchScreen.xib; 396 | sourceTree = ""; 397 | }; 398 | /* End PBXVariantGroup section */ 399 | 400 | /* Begin XCBuildConfiguration section */ 401 | E1F479151BA7030B00702420 /* Debug */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | ALWAYS_SEARCH_USER_PATHS = NO; 405 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 406 | CLANG_CXX_LIBRARY = "libc++"; 407 | CLANG_ENABLE_MODULES = YES; 408 | CLANG_ENABLE_OBJC_ARC = YES; 409 | CLANG_WARN_BOOL_CONVERSION = YES; 410 | CLANG_WARN_CONSTANT_CONVERSION = YES; 411 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 412 | CLANG_WARN_EMPTY_BODY = YES; 413 | CLANG_WARN_ENUM_CONVERSION = YES; 414 | CLANG_WARN_INT_CONVERSION = YES; 415 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 416 | CLANG_WARN_UNREACHABLE_CODE = YES; 417 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 418 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 419 | COPY_PHASE_STRIP = NO; 420 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_DYNAMIC_NO_PIC = NO; 424 | GCC_NO_COMMON_BLOCKS = YES; 425 | GCC_OPTIMIZATION_LEVEL = 0; 426 | GCC_PREPROCESSOR_DEFINITIONS = ( 427 | "DEBUG=1", 428 | "$(inherited)", 429 | ); 430 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 431 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 432 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 433 | GCC_WARN_UNDECLARED_SELECTOR = YES; 434 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 435 | GCC_WARN_UNUSED_FUNCTION = YES; 436 | GCC_WARN_UNUSED_VARIABLE = YES; 437 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 438 | MTL_ENABLE_DEBUG_INFO = YES; 439 | ONLY_ACTIVE_ARCH = YES; 440 | SDKROOT = iphoneos; 441 | TARGETED_DEVICE_FAMILY = "1,2"; 442 | }; 443 | name = Debug; 444 | }; 445 | E1F479161BA7030B00702420 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | ALWAYS_SEARCH_USER_PATHS = NO; 449 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 450 | CLANG_CXX_LIBRARY = "libc++"; 451 | CLANG_ENABLE_MODULES = YES; 452 | CLANG_ENABLE_OBJC_ARC = YES; 453 | CLANG_WARN_BOOL_CONVERSION = YES; 454 | CLANG_WARN_CONSTANT_CONVERSION = YES; 455 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 456 | CLANG_WARN_EMPTY_BODY = YES; 457 | CLANG_WARN_ENUM_CONVERSION = YES; 458 | CLANG_WARN_INT_CONVERSION = YES; 459 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 460 | CLANG_WARN_UNREACHABLE_CODE = YES; 461 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 462 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 463 | COPY_PHASE_STRIP = NO; 464 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 465 | ENABLE_NS_ASSERTIONS = NO; 466 | ENABLE_STRICT_OBJC_MSGSEND = YES; 467 | GCC_C_LANGUAGE_STANDARD = gnu99; 468 | GCC_NO_COMMON_BLOCKS = YES; 469 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 470 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 471 | GCC_WARN_UNDECLARED_SELECTOR = YES; 472 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 473 | GCC_WARN_UNUSED_FUNCTION = YES; 474 | GCC_WARN_UNUSED_VARIABLE = YES; 475 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 476 | MTL_ENABLE_DEBUG_INFO = NO; 477 | SDKROOT = iphoneos; 478 | TARGETED_DEVICE_FAMILY = "1,2"; 479 | VALIDATE_PRODUCT = YES; 480 | }; 481 | name = Release; 482 | }; 483 | E1F479181BA7030B00702420 /* Debug */ = { 484 | isa = XCBuildConfiguration; 485 | buildSettings = { 486 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 487 | CODE_SIGN_IDENTITY = "iPhone Developer"; 488 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 489 | ENABLE_BITCODE = NO; 490 | FRAMEWORK_SEARCH_PATHS = ( 491 | "$(inherited)", 492 | "$(PROJECT_DIR)/PrinterDemo", 493 | "$(PROJECT_DIR)/PrinterDemo/PgyUpdate/PgySDK/sdk", 494 | ); 495 | INFOPLIST_FILE = PrinterDemo/Info.plist; 496 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 497 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 498 | LIBRARY_SEARCH_PATHS = ( 499 | "$(inherited)", 500 | "$(PROJECT_DIR)/PrinterDemo", 501 | ); 502 | PRODUCT_BUNDLE_IDENTIFIER = com.hj.inhouseiphoneCBT; 503 | PRODUCT_NAME = "$(TARGET_NAME)"; 504 | PROVISIONING_PROFILE = ""; 505 | }; 506 | name = Debug; 507 | }; 508 | E1F479191BA7030B00702420 /* Release */ = { 509 | isa = XCBuildConfiguration; 510 | buildSettings = { 511 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 512 | CODE_SIGN_IDENTITY = "iPhone Developer"; 513 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 514 | ENABLE_BITCODE = NO; 515 | FRAMEWORK_SEARCH_PATHS = ( 516 | "$(inherited)", 517 | "$(PROJECT_DIR)/PrinterDemo", 518 | "$(PROJECT_DIR)/PrinterDemo/PgyUpdate/PgySDK/sdk", 519 | ); 520 | INFOPLIST_FILE = PrinterDemo/Info.plist; 521 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 522 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 523 | LIBRARY_SEARCH_PATHS = ( 524 | "$(inherited)", 525 | "$(PROJECT_DIR)/PrinterDemo", 526 | ); 527 | PRODUCT_BUNDLE_IDENTIFIER = com.hj.inhouseiphoneCBT; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | PROVISIONING_PROFILE = ""; 530 | }; 531 | name = Release; 532 | }; 533 | E1F4791B1BA7030B00702420 /* Debug */ = { 534 | isa = XCBuildConfiguration; 535 | buildSettings = { 536 | BUNDLE_LOADER = "$(TEST_HOST)"; 537 | FRAMEWORK_SEARCH_PATHS = ( 538 | "$(SDKROOT)/Developer/Library/Frameworks", 539 | "$(inherited)", 540 | ); 541 | GCC_PREPROCESSOR_DEFINITIONS = ( 542 | "DEBUG=1", 543 | "$(inherited)", 544 | ); 545 | INFOPLIST_FILE = PrinterDemoTests/Info.plist; 546 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PrinterDemo.app/PrinterDemo"; 549 | }; 550 | name = Debug; 551 | }; 552 | E1F4791C1BA7030B00702420 /* Release */ = { 553 | isa = XCBuildConfiguration; 554 | buildSettings = { 555 | BUNDLE_LOADER = "$(TEST_HOST)"; 556 | FRAMEWORK_SEARCH_PATHS = ( 557 | "$(SDKROOT)/Developer/Library/Frameworks", 558 | "$(inherited)", 559 | ); 560 | INFOPLIST_FILE = PrinterDemoTests/Info.plist; 561 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 562 | PRODUCT_NAME = "$(TARGET_NAME)"; 563 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PrinterDemo.app/PrinterDemo"; 564 | }; 565 | name = Release; 566 | }; 567 | /* End XCBuildConfiguration section */ 568 | 569 | /* Begin XCConfigurationList section */ 570 | E1F478EC1BA7030B00702420 /* Build configuration list for PBXProject "PrinterDemo" */ = { 571 | isa = XCConfigurationList; 572 | buildConfigurations = ( 573 | E1F479151BA7030B00702420 /* Debug */, 574 | E1F479161BA7030B00702420 /* Release */, 575 | ); 576 | defaultConfigurationIsVisible = 0; 577 | defaultConfigurationName = Release; 578 | }; 579 | E1F479171BA7030B00702420 /* Build configuration list for PBXNativeTarget "PrinterDemo" */ = { 580 | isa = XCConfigurationList; 581 | buildConfigurations = ( 582 | E1F479181BA7030B00702420 /* Debug */, 583 | E1F479191BA7030B00702420 /* Release */, 584 | ); 585 | defaultConfigurationIsVisible = 0; 586 | defaultConfigurationName = Release; 587 | }; 588 | E1F4791A1BA7030B00702420 /* Build configuration list for PBXNativeTarget "PrinterDemoTests" */ = { 589 | isa = XCConfigurationList; 590 | buildConfigurations = ( 591 | E1F4791B1BA7030B00702420 /* Debug */, 592 | E1F4791C1BA7030B00702420 /* Release */, 593 | ); 594 | defaultConfigurationIsVisible = 0; 595 | defaultConfigurationName = Release; 596 | }; 597 | /* End XCConfigurationList section */ 598 | 599 | /* Begin XCVersionGroup section */ 600 | E1F478FB1BA7030B00702420 /* PrinterDemo.xcdatamodeld */ = { 601 | isa = XCVersionGroup; 602 | children = ( 603 | E1F478FC1BA7030B00702420 /* PrinterDemo.xcdatamodel */, 604 | ); 605 | currentVersion = E1F478FC1BA7030B00702420 /* PrinterDemo.xcdatamodel */; 606 | path = PrinterDemo.xcdatamodeld; 607 | sourceTree = ""; 608 | versionGroupType = wrapper.xcdatamodel; 609 | }; 610 | /* End XCVersionGroup section */ 611 | }; 612 | rootObject = E1F478E91BA7030B00702420 /* Project object */; 613 | } 614 | -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/project.xcworkspace/xcshareddata/PrinterDemo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 984E842E-1006-4E78-9C03-F41A671F5146 9 | IDESourceControlProjectName 10 | PrinterDemo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 9483537c-b847-49c3-805d-b05972c36ec1++5326 14 | svn://niurenhaiyang.cn/ios 15 | 16 | IDESourceControlProjectPath 17 | mastersale/sdk/PrinterDemo/PrinterDemo.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 9483537c-b847-49c3-805d-b05972c36ec1++5326 21 | ../../../../.. 22 | 23 | IDESourceControlProjectRepositoryRootDictionary 24 | 25 | 9483537c-b847-49c3-805d-b05972c36ec1++5326 26 | svn://niurenhaiyang.cn 27 | 28 | IDESourceControlProjectURL 29 | svn://niurenhaiyang.cn/ios/mastersale/sdk/PrinterDemo/PrinterDemo.xcodeproj 30 | IDESourceControlProjectVersion 31 | 111 32 | IDESourceControlProjectWCCIdentifier 33 | 9483537c-b847-49c3-805d-b05972c36ec1++5326 34 | IDESourceControlProjectWCConfigurations 35 | 36 | 37 | IDESourceControlRepositoryExtensionIdentifierKey 38 | public.vcs.subversion 39 | IDESourceControlWCCIdentifierKey 40 | 9483537c-b847-49c3-805d-b05972c36ec1++5326 41 | IDESourceControlWCCName 42 | ios 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/project.xcworkspace/xcshareddata/PrinterDemo.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "a305ad4d-cadb-8d40-2dc1-ce57b7db7bff++505", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | "9483537c-b847-49c3-805d-b05972c36ec1++5326" : { 5 | 6 | }, 7 | "9483537c-b847-49c3-805d-b05972c36ec1++398" : { 8 | 9 | }, 10 | "a305ad4d-cadb-8d40-2dc1-ce57b7db7bff++505" : { 11 | 12 | } 13 | }, 14 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 15 | "9483537c-b847-49c3-805d-b05972c36ec1++5326" : 0, 16 | "9483537c-b847-49c3-805d-b05972c36ec1++398" : 0, 17 | "a305ad4d-cadb-8d40-2dc1-ce57b7db7bff++505" : 0 18 | }, 19 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "984E842E-1006-4E78-9C03-F41A671F5146", 20 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 21 | "9483537c-b847-49c3-805d-b05972c36ec1++5326" : "..\/..", 22 | "9483537c-b847-49c3-805d-b05972c36ec1++398" : "..", 23 | "a305ad4d-cadb-8d40-2dc1-ce57b7db7bff++505" : "printer\/" 24 | }, 25 | "DVTSourceControlWorkspaceBlueprintNameKey" : "PrinterDemo", 26 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 27 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "PrinterDemoDev\/PrinterDemo.xcodeproj", 28 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 29 | { 30 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "svn:\/\/mmd520.cn", 31 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Subversion", 32 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "9483537c-b847-49c3-805d-b05972c36ec1++398" 33 | }, 34 | { 35 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "svn:\/\/niurenhaiyang.cn", 36 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Subversion", 37 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "9483537c-b847-49c3-805d-b05972c36ec1++5326" 38 | }, 39 | { 40 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/erduhai%40qq.com@github.com\/newOcean\/printer", 41 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Subversion", 42 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "a305ad4d-cadb-8d40-2dc1-ce57b7db7bff++505" 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/project.xcworkspace/xcuserdata/chenbotao.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo.xcodeproj/project.xcworkspace/xcuserdata/chenbotao.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/project.xcworkspace/xcuserdata/wuyiqi.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo.xcodeproj/project.xcworkspace/xcuserdata/wuyiqi.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/project.xcworkspace/xcuserdata/wuyiqi.xcuserdatad/UserInterfaceState.xcuserstate.r905: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo.xcodeproj/project.xcworkspace/xcuserdata/wuyiqi.xcuserdatad/UserInterfaceState.xcuserstate.r905 -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/project.xcworkspace/xcuserdata/wuyiqi.xcuserdatad/UserInterfaceState.xcuserstate.r911: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo.xcodeproj/project.xcworkspace/xcuserdata/wuyiqi.xcuserdatad/UserInterfaceState.xcuserstate.r911 -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/project.xcworkspace/xcuserdata/wuyiqi.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/xcuserdata/chenbotao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/xcuserdata/chenbotao.xcuserdatad/xcschemes/PrinterDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/xcuserdata/chenbotao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PrinterDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | E1F478F01BA7030B00702420 16 | 17 | primary 18 | 19 | 20 | E1F4790C1BA7030B00702420 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/xcuserdata/wuyiqi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 51 | 52 | 66 | 67 | 68 | 69 | 70 | 72 | 84 | 85 | 86 | 88 | 100 | 101 | 102 | 104 | 116 | 117 | 118 | 120 | 132 | 133 | 134 | 136 | 148 | 149 | 150 | 152 | 164 | 165 | 166 | 168 | 180 | 181 | 182 | 184 | 196 | 197 | 198 | 200 | 212 | 213 | 214 | 216 | 228 | 229 | 230 | 232 | 244 | 245 | 246 | 247 | 248 | -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/xcuserdata/wuyiqi.xcuserdatad/xcschemes/PrinterDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /PrinterDemo.xcodeproj/xcuserdata/wuyiqi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PrinterDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | E1F478F01BA7030B00702420 16 | 17 | primary 18 | 19 | 20 | E1F4790C1BA7030B00702420 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PrinterDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 15/9/14. 6 | // Copyright (c) 2015年 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @class ViewController; 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | //@property (strong, nonatomic) UIWindow *window; 17 | 18 | @property (strong, nonatomic) ViewController *viewController; 19 | 20 | @property (strong, nonatomic) UINavigationController *navController; 21 | 22 | @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; 23 | @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; 24 | @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; 25 | 26 | - (void)saveContext; 27 | - (NSURL *)applicationDocumentsDirectory; 28 | 29 | 30 | @end 31 | 32 | -------------------------------------------------------------------------------- /PrinterDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 15/9/14. 6 | // Copyright (c) 2015年 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "HJPrinterDemoViewController.h" 11 | //#import "PrinterSDK.h" 12 | #import "PrinterSDK.h" 13 | #import "SVProgressHUD.h" 14 | #import 15 | @interface AppDelegate () 16 | 17 | @end 18 | 19 | @implementation AppDelegate 20 | 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | // Override point for customization after application launch. 24 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 25 | HJPrinterDemoViewController *rootView = [[HJPrinterDemoViewController alloc] init]; 26 | rootView.title = @"Root View"; 27 | 28 | self.navController = [[UINavigationController alloc] init]; 29 | [self.navController pushViewController:rootView animated:YES]; 30 | self.window.rootViewController =rootView; 31 | [self.window addSubview:self.navController.view]; 32 | [self.window makeKeyAndVisible]; 33 | //自动更新测试app 34 | 35 | // [[PgyUpdateManager sharedPgyManager] startManagerWithAppId:@"d64c6ec8b9047b8de63bff6e89874f99"]; 36 | // [[PgyUpdateManager sharedPgyManager] checkUpdate]; 37 | // 38 | // [SVProgressHUD showWithStatus:@"正在自动连接打印机"]; 39 | // 40 | [PrinterWraper autoConnectLastPrinterTimeout:10 Completion:^(NSString *uid) { 41 | NSLog(@"自动连接 uid=%@",uid); 42 | if (uid) { 43 | [SVProgressHUD showSuccessWithStatus:@"自动连接成功"]; 44 | }else 45 | [SVProgressHUD dismiss]; 46 | }]; 47 | 48 | // [self appearanceConfig]; 49 | return YES; 50 | } 51 | - (void)appearanceConfig 52 | { 53 | [UINavigationBar appearance].tintColor = [UIColor whiteColor]; 54 | [[UINavigationBar appearance] setBackgroundImage:[self statusBar] forBarMetrics:UIBarMetricsDefault]; 55 | [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:18.]}]; 56 | } 57 | 58 | - (UIImage *)statusBar 59 | { 60 | UIImage *image; 61 | UIGraphicsBeginImageContext(CGSizeMake([UIScreen mainScreen].bounds.size.width, 20.)); 62 | UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 20.)]; 63 | CAGradientLayer *gradientLayer1 = [CAGradientLayer layer]; 64 | gradientLayer1.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 20.); 65 | // [gradientLayer1 setColors:@[(id)RGB(39.,198.,160.).CGColor,(id)RGB(39.,200.,122.).CGColor,(id)RGB(13.,196.,76.).CGColor]]; 66 | [gradientLayer1 setColors:@[(id)[UIColor redColor].CGColor,(id)[UIColor orangeColor].CGColor]]; 67 | [gradientLayer1 setStartPoint:CGPointMake(0, 0)]; 68 | [gradientLayer1 setEndPoint:CGPointMake(1, 0)]; 69 | [view.layer addSublayer:gradientLayer1]; 70 | [view.layer renderInContext:UIGraphicsGetCurrentContext()]; 71 | image = UIGraphicsGetImageFromCurrentImageContext(); 72 | UIGraphicsEndImageContext(); 73 | return image; 74 | } 75 | - (void)applicationWillResignActive:(UIApplication *)application { 76 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 77 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 78 | } 79 | 80 | - (void)applicationDidEnterBackground:(UIApplication *)application { 81 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 82 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 83 | } 84 | 85 | - (void)applicationWillEnterForeground:(UIApplication *)application { 86 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 87 | } 88 | 89 | - (void)applicationDidBecomeActive:(UIApplication *)application { 90 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 91 | } 92 | 93 | - (void)applicationWillTerminate:(UIApplication *)application { 94 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 95 | // Saves changes in the application's managed object context before the application terminates. 96 | [self saveContext]; 97 | } 98 | 99 | #pragma mark - Core Data stack 100 | 101 | @synthesize managedObjectContext = _managedObjectContext; 102 | @synthesize managedObjectModel = _managedObjectModel; 103 | @synthesize persistentStoreCoordinator = _persistentStoreCoordinator; 104 | 105 | - (NSURL *)applicationDocumentsDirectory { 106 | // The directory the application uses to store the Core Data store file. This code uses a directory named "com.cmcc.PrinterDemo" in the application's documents directory. 107 | return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; 108 | } 109 | 110 | - (NSManagedObjectModel *)managedObjectModel { 111 | // The managed object model for the application. It is a fatal error for the application not to be able to find and load its model. 112 | if (_managedObjectModel != nil) { 113 | return _managedObjectModel; 114 | } 115 | NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"PrinterDemo" withExtension:@"momd"]; 116 | _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; 117 | return _managedObjectModel; 118 | } 119 | 120 | - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { 121 | // The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. 122 | if (_persistentStoreCoordinator != nil) { 123 | return _persistentStoreCoordinator; 124 | } 125 | 126 | // Create the coordinator and store 127 | 128 | _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; 129 | NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"PrinterDemo.sqlite"]; 130 | NSError *error = nil; 131 | NSString *failureReason = @"There was an error creating or loading the application's saved data."; 132 | if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) { 133 | // Report any error we got. 134 | NSMutableDictionary *dict = [NSMutableDictionary dictionary]; 135 | dict[NSLocalizedDescriptionKey] = @"Failed to initialize the application's saved data"; 136 | dict[NSLocalizedFailureReasonErrorKey] = failureReason; 137 | dict[NSUnderlyingErrorKey] = error; 138 | error = [NSError errorWithDomain:@"YOUR_ERROR_DOMAIN" code:9999 userInfo:dict]; 139 | // Replace this with code to handle the error appropriately. 140 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 141 | NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 142 | abort(); 143 | } 144 | 145 | return _persistentStoreCoordinator; 146 | } 147 | 148 | 149 | - (NSManagedObjectContext *)managedObjectContext { 150 | // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) 151 | if (_managedObjectContext != nil) { 152 | return _managedObjectContext; 153 | } 154 | 155 | NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; 156 | if (!coordinator) { 157 | return nil; 158 | } 159 | _managedObjectContext = [[NSManagedObjectContext alloc] init]; 160 | [_managedObjectContext setPersistentStoreCoordinator:coordinator]; 161 | return _managedObjectContext; 162 | } 163 | 164 | #pragma mark - Core Data Saving support 165 | 166 | - (void)saveContext { 167 | NSManagedObjectContext *managedObjectContext = self.managedObjectContext; 168 | if (managedObjectContext != nil) { 169 | NSError *error = nil; 170 | if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) { 171 | // Replace this implementation with code to handle the error appropriately. 172 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 173 | NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 174 | abort(); 175 | } 176 | } 177 | } 178 | 179 | @end 180 | -------------------------------------------------------------------------------- /PrinterDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /PrinterDemo/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 | -------------------------------------------------------------------------------- /PrinterDemo/HJPrinterDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HJPrinterDemoViewController.h 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 9/15/15. 6 | // Copyright (c) 2015 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HJPrinterDemoViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /PrinterDemo/HJPrinterDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HJPrinterDemoViewController.m 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 9/15/15. 6 | // Copyright (c) 2015 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import "HJPrinterDemoViewController.h" 10 | //#import "PrinterListViewController.h" 11 | #import "PrinterSDK.h" 12 | //#import "PrinterSDK.h" 13 | #import "FormatSettingTableViewController.h" 14 | #import "PrinterListViewController.h" 15 | 16 | @interface HJPrinterDemoViewController () 17 | 18 | @end 19 | 20 | @implementation HJPrinterDemoViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | // Do any additional setup after loading the view from its nib. 25 | //读取打印机设置内容 26 | // NSDictionary *setting = [PrinterWraper getPrinterSetting]; 27 | 28 | // NSMutableDictionary *newsetting=[NSMutableDictionary dictionaryWithDictionary:setting]; 29 | // [newsetting setObject:@1 forKey:@"showconfigure"];//sdk自带打印机配置 30 | 31 | // [PrinterWraper setPrinterSetting:newsetting]; 32 | 33 | 34 | } 35 | 36 | - (void)didReceiveMemoryWarning { 37 | [super didReceiveMemoryWarning]; 38 | // Dispose of any resources that can be recreated. 39 | } 40 | 41 | /* 42 | #pragma mark - Navigation 43 | 44 | // In a storyboard-based application, you will often want to do a little preparation before navigation 45 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 46 | // Get the new view controller using [segue destinationViewController]. 47 | // Pass the selected object to the new view controller. 48 | } 49 | */ 50 | - (IBAction)print:(NSString *)jsonString{ 51 | 52 | #warning 请确保本身的navigationController是有效的 53 | #warning 工程的General->Embedded Binaries + PrinterSdk.framework 54 | #warning 请试用真机 否则会有编译错误 55 | 56 | //设置格式 大字体 行间距28 局中 57 | [PrinterWraper setPrintFormat:3 LineSpace:28 alinment:1 rotation:0];// 3 大字体 ,28默认行间距,1局中对齐 58 | 59 | //打印标题 60 | [PrinterWraper addPrintText:@"金百万微站*2160\n"];//打印文字 61 | //设置标题的格式 62 | [PrinterWraper setPrintFormat:1 LineSpace:28 alinment:0 rotation:0];// 1 小字体 ,28默认行间距,0左对齐 63 | 64 | //打印副标题 65 | [PrinterWraper addPrintText:@"U味儿 客服电话: 4006-597-597\n"];//打印文字 66 | 67 | //设置副标题的格式 68 | [PrinterWraper setPrintFormat:1 LineSpace:28 alinment:0 rotation:0];// 1 小字体 ,28默认行间距,0左对齐 69 | 70 | //打印副标题 71 | [PrinterWraper addPrintText:@"********************************\n"];//打印文字 72 | 73 | 74 | NSArray *headers =@[@"菜单",@"单价",@"数量"]; 75 | NSArray *values0 =@[@"黑米糕",@"14",@"X1"]; 76 | NSArray *values1 =@[@"新派奥尔良鸡翅",@"88",@"X5"]; 77 | NSArray *values2 =@[@"香煎藕夹",@"18",@"X8"]; 78 | NSArray* body =@[headers,values0,values1,values2]; 79 | 80 | 81 | //打印商品列表,会自动排版,要求数组长度一致,空白地方用@"" 82 | [PrinterWraper addItemLines:body]; 83 | 84 | 85 | //设置格式 大字体 行间距28 局中 86 | [PrinterWraper setPrintFormat:3 LineSpace:28 alinment:1 rotation:0];// 3 大字体 ,28默认行间距,1局中对齐 87 | 88 | NSString *str = @"合计: ¥53\n"; 89 | 90 | NSString *utfStr = [[NSString alloc] initWithData:[str dataUsingEncoding:NSUTF8StringEncoding] encoding:NSUTF8StringEncoding]; 91 | 92 | //打印标题 93 | [PrinterWraper addPrintText:utfStr];//打印文字 94 | 95 | //设置副标题的格式 96 | [PrinterWraper setPrintFormat:1 LineSpace:28 alinment:0 rotation:0];// 1 小字体 ,28默认行间距,0左对齐 97 | 98 | //打印副标题 99 | [PrinterWraper addPrintText:@"********************************\n"];//打印文字 100 | 101 | NSArray *values0_1 =@[@"订单类型:",@"半成品"]; 102 | NSArray *values1_1 =@[@"订单渠道:",@"微站"]; 103 | NSArray *values2_1 =@[@"服务品牌:",@"金百万"]; 104 | NSArray *values3_1 =@[@"服务门店:",@"金百万(正运通店)"]; 105 | NSArray *values4_1 =@[@"门店电话:",@"010-60592926"]; 106 | NSArray *values5_1 =@[@"下单时间:",@"2016-04-10 09:41:32"]; 107 | NSArray *values6_1 =@[@"送餐时间:",@"预定[2016-04-10 12:00-12:30]"]; 108 | NSArray *values7_1 =@[@"支付方式:",@"现金支付"]; 109 | NSArray* body_1 =@[values0_1,values1_1,values2_1,values3_1,values4_1,values5_1,values6_1,values7_1]; 110 | 111 | 112 | //打印商品列表,会自动排版,要求数组长度一致,空白地方用@"" 113 | [PrinterWraper addItemLines:body_1]; 114 | 115 | //设置副标题的格式 116 | [PrinterWraper setPrintFormat:1 LineSpace:28 alinment:0 rotation:0];// 1 小字体 ,28默认行间距,0左对齐 117 | 118 | //打印副标题 119 | [PrinterWraper addPrintText:@"********************************\n"];//打印文字 120 | 121 | 122 | 123 | [PrinterWraper addPrintText:@"抓饭的 先生\n18310956585\n北京市通州区正运通酒店发\n"]; 124 | 125 | //打印副标题 126 | [PrinterWraper addPrintText:@"********************************\n"];//打印文字 127 | 128 | //打印副标题 129 | [PrinterWraper addPrintText:@"骑士签名:"]; 130 | 131 | 132 | //打印二维码 133 | // [PrinterWraper addPrintBarcode:@"http://www.baidu.com" isTwoDimensionalCode:1];//二维码 134 | //// 打印一维码 135 | // [PrinterWraper addPrintBarcode:@"123456789012" isTwoDimensionalCode:0];//1维码 136 | // [PrinterWraper addPrintBarcode:@"123456789013" isTwoDimensionalCode:0];//1维码 137 | 138 | 139 | [PrinterWraper addPrintText:@"\n\n"];//打印文字 140 | // 开始启动打印 141 | // [PrinterWraper startPrint:self.navigationController]; 142 | 143 | BOOL res= [PrinterWraper startPrint:nil]; 144 | 145 | // if (!res) { 146 | // PrinterListViewController *detail=[[PrinterListViewController alloc] init]; 147 | // // detail.taskmodel =model; 148 | // [self.navigationController pushViewController:detail animated:YES]; 149 | // 150 | // 151 | // } 152 | 153 | } 154 | 155 | 156 | - (IBAction)choosePrinter:(id)sender { 157 | 158 | PrinterListViewController *detail=[[PrinterListViewController alloc] init]; 159 | 160 | [self.navigationController pushViewController:detail animated:YES]; 161 | 162 | } 163 | - (IBAction)confiurePrinter:(id)sender { 164 | 165 | FormatSettingTableViewController *detail =[[FormatSettingTableViewController alloc] init]; 166 | 167 | [self.navigationController pushViewController:detail animated:YES]; 168 | 169 | } 170 | 171 | 172 | @end 173 | -------------------------------------------------------------------------------- /PrinterDemo/HJPrinterDemoViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 28 | 38 | 45 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /PrinterDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /PrinterDemo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /PrinterDemo/Images.xcassets/ico144.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ico144.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 | } -------------------------------------------------------------------------------- /PrinterDemo/Images.xcassets/ico144.imageset/ico144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/Images.xcassets/ico144.imageset/ico144.png -------------------------------------------------------------------------------- /PrinterDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | 打印测试 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.9 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.9 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/Headers/PgyUpdateManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // PgyUpdateManager.h 3 | // Pods 4 | // 5 | // Created by Scott Lei on 15/9/16. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface PgyUpdateManager : NSObject 12 | 13 | + (PgyUpdateManager *)sharedPgyManager; 14 | 15 | /** 16 | * 启动蒲公英SDK 17 | * @param appId 应用程序ID,从蒲公英网站上获取。 18 | */ 19 | - (void)startManagerWithAppId:(NSString *)appId; 20 | 21 | /** 22 | * 检查是否有版本更新。 23 | * 如果开发者在蒲公英上提交了新版本,则调用此方法后会弹出更新提示界面。 24 | */ 25 | - (void)checkUpdate; 26 | 27 | /** 28 | * 检查是否有版本更新。 29 | * 30 | * @param delegate 自定义checkUpdateWithDelegete方法的对象 31 | * @param updateMethodWithDictionary 当checkUpdateWithDelegete事件完成时此方法会被调用,包含更新信息的字典也被回传。 32 | * 如果有更新信息,那么字典里就会包含新版本的信息,否则的话字典信息为nil。 33 | */ 34 | - (void)checkUpdateWithDelegete:(id)delegate selector:(SEL)updateMethodWithDictionary; 35 | 36 | /** 37 | * 检查更新是根据本地存储的Build号和蒲公英上的最新Build号比较来完成的。如果调用checkUpdateWithDelegete,SDK会获取到最新的 38 | * Build号,但是checkUpdateWithDelegete方法自己不会来更新本地版本号,如果需要更新本地版本号,则需要调用此方法。 39 | */ 40 | - (void)updateLocalBuildNumber; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/Info.plist -------------------------------------------------------------------------------- /PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/PgyUpdate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/PgyUpdate -------------------------------------------------------------------------------- /PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/Versions/A/Headers/PgyUpdateManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // PgyUpdateManager.h 3 | // Pods 4 | // 5 | // Created by Scott Lei on 15/9/16. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface PgyUpdateManager : NSObject 12 | 13 | + (PgyUpdateManager *)sharedPgyManager; 14 | 15 | /** 16 | * 启动蒲公英SDK 17 | * @param appId 应用程序ID,从蒲公英网站上获取。 18 | */ 19 | - (void)startManagerWithAppId:(NSString *)appId; 20 | 21 | /** 22 | * 检查是否有版本更新。 23 | * 如果开发者在蒲公英上提交了新版本,则调用此方法后会弹出更新提示界面。 24 | */ 25 | - (void)checkUpdate; 26 | 27 | /** 28 | * 检查是否有版本更新。 29 | * 30 | * @param delegate 自定义checkUpdateWithDelegete方法的对象 31 | * @param updateMethodWithDictionary 当checkUpdateWithDelegete事件完成时此方法会被调用,包含更新信息的字典也被回传。 32 | * 如果有更新信息,那么字典里就会包含新版本的信息,否则的话字典信息为nil。 33 | */ 34 | - (void)checkUpdateWithDelegete:(id)delegate selector:(SEL)updateMethodWithDictionary; 35 | 36 | /** 37 | * 检查更新是根据本地存储的Build号和蒲公英上的最新Build号比较来完成的。如果调用checkUpdateWithDelegete,SDK会获取到最新的 38 | * Build号,但是checkUpdateWithDelegete方法自己不会来更新本地版本号,如果需要更新本地版本号,则需要调用此方法。 39 | */ 40 | - (void)updateLocalBuildNumber; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/Versions/A/PgyUpdate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/Versions/A/PgyUpdate -------------------------------------------------------------------------------- /PrinterDemo/PgyUpdate/PgySDK/sdk/PgyUpdate.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /PrinterDemo/PrinterDemo.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | PrinterDemo.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /PrinterDemo/PrinterDemo.xcdatamodeld/PrinterDemo.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /PrinterDemo/PrinterSDK.h: -------------------------------------------------------------------------------- 1 | //---------------使用必读-------------- 2 | //---------------使用必读-------------- 3 | //---------------使用必读-------------- 4 | //---------------使用必读-------------- 5 | //---------------使用必读-------------- 6 | 7 | /* ---------------使用必读-------------- 8 | 1.已经支持58mm 80mm 110mm 蓝牙打印机,以及airprint苹果台式打印机。如果发现适配问题(乱码,二维码不能打印等),请联系QQ40255986 9 | 2.使用此sdk表示同意只使用我们代理的打印机(物美价廉^-^),咨询淘宝购买网址http://shop113684150.taobao.com 10 | 3.库在使用时,加入工程,并且在工程设置 General ->Embedded Binaries 添加此库 11 | 4.实现功能,订单打印,二维码打印(部分打印机),多手机同时打印(部分打印机),打印速度快,自动重连 12 | */ 13 | 14 | 15 | 16 | 17 | 18 | #import 19 | 20 | //! Project version number for PrinterSDK. 21 | //FOUNDATION_EXPORT double PrinterSDKVersionNumber; 22 | // 23 | ////! Project version string for PrinterSDK. 24 | //FOUNDATION_EXPORT const unsigned char PrinterSDKVersionString[]; 25 | #define kNotify_print_finish @"kNotify_print_finish" 26 | #define kNotify_print_disconnect @"kNotify_print_disconnect" 27 | //打印机delegate 28 | @protocol BluetoothDelegate 29 | @optional 30 | -(void)BlueToothOpen:(BOOL)isopen; 31 | -(void)updateBluetoothDevice:(NSMutableArray*)devices; 32 | -(void)didConnected:(NSString*)deviceUid Result:(BOOL)success; 33 | -(void)finishPrint; 34 | 35 | @end 36 | 37 | //订单头尾内容 38 | @interface printModel : NSObject 39 | @property (nonatomic,copy) NSString *title;//标题 四季青精品店(销售单) 40 | @property (nonatomic,copy) NSString *headText;//页眉, 41 | 42 | //主体内容三选一 43 | @property (nonatomic,strong) NSArray *headerMultiValues;//一行表头 多行值 44 | @property (nonatomic,strong) NSArray *headersValues;//一行表头一行值 45 | @property (nonatomic,copy) NSString *bodyText;//主体内容 46 | @property (nonatomic,copy) NSString *sumaryText;//总计 大字体打印 47 | 48 | 49 | @property (nonatomic,copy) NSString *footText;//页脚 50 | @property (nonatomic,copy) NSString *advise;//广告 foottext的下方 51 | @property (nonatomic,copy) NSString *barcode;//二维码地址 52 | 53 | 54 | //--------end 55 | 56 | //@property int odertype;//0销售单 1采购单 2批发单 如果写了标题就不需要 57 | @property BOOL isLabel;//打印标签,打印productList中所有商品的标签,name,color,size,barcode_1,price 58 | //@property BOOL composedSummary;//数量 价格 小记 是否合到一起(数量/单价/小记) 59 | @end 60 | 61 | @interface PrinterWraper : NSObject 62 | /* 打印设置的默认值,可以修改,或者获取此值,对应于打印模版设置的内容 63 | @"lineSpace" :@28 0~254 默认28 对应4毫米 64 | @{@"printertype":@0,// 打印机宽度 0 58mm,1 80mm,2 110mm,3,A4 针式打印机蓝牙适配器,3 airprint A4(台式无线打印机) 65 | @"printerfontsize":@0,//字体大小 0自动, 1小,2中,3大, 66 | @"copycount":@0,//0 1联,1 2联 ,2 3联 67 | @"autoprint":@0,//0 不自动打印 1自动打印 68 | @"company":NSLocalizedString(@"公司名称", @""),//公司名称 第一行自动居中 大字体,可多行 69 | @"operater":NSLocalizedString(@"店小二", @""),//开单员 70 | @"welcome":NSLocalizedString(@"谢谢惠顾", @""),//页脚,可多行 71 | @"barcode":@"",//二维码的链接地址 72 | 73 | @"name":@YES,//名称 74 | @"code":@NO,//商品条码编号 75 | @"styenum":@YES,//款号 货号 76 | @"color":@YES,//颜色 77 | @"spec":@NO,//规格 78 | @"count":@YES,//数量 79 | @"unit":@YES,//单位 80 | @"price":@YES,//价格 81 | @"xiaoji":@YES,//小记 82 | @"comment":@YES,//订单备注 83 | 84 | @"needdisconnect":@NO //YES打印后断开 支持多手机机链接,速度较慢 85 | }; 86 | */ 87 | +(NSDictionary*)getPrinterSetting; 88 | +(void)setPrinterSetting:(NSDictionary*)dic; 89 | +(NSInteger)getPrinterMaxWidth;//获取打印机字符宽度,32~60个字符宽 90 | +(NSString*)getSplitLine;//获取标准的分割线 91 | //扫描打印机 92 | +(void)SetBlutoothDelegate:(id)delegate; 93 | +(void)StartScanTimeout:(int)timeout; 94 | +(void)StopScan; 95 | 96 | +(void)connectPrinter:(NSString*)peripheraluid shouldreset:(BOOL)reset; 97 | +(void)disconnectPrinter:(NSString*)uid; 98 | 99 | //选择打印机 100 | //+(void)chooseNewPrinter:(UIViewController*)sender; 101 | //自动连接上一次使用的打印机 102 | +(void)autoConnectLastPrinterTimeout:(NSInteger)timeout Completion:(void(^)(NSString *))block; 103 | +(BOOL)isPrinterConnected; 104 | +(BOOL)isPrinterAvailable; 105 | //+(BOOL)isConnected; 106 | 107 | 108 | //根据订单数据model打印,SDK负责排版 109 | +(BOOL)printModel:(printModel*)model fromviewc:(UIViewController*)sender printeruid:(NSString*)uid preview:(BOOL)preview failed:(void (^)( BOOL res ))choose; 110 | //分行格式控制打印 111 | //fontSize 字体大小 0小字体,1中字体,2大, 112 | //lineSpace :行间距 0~254 默认28 对应4毫米 113 | //alin 对齐 0左,1居中,2右 114 | //rotation 0竖直打印,1顺时针旋转90度打印 115 | +(void)setPrintFormat:(int)printerfontsize LineSpace:(int)lineSpace alinment:(int)alin rotation:(int)rotation; 116 | +(void)addPrintText:(NSString*)text; 117 | +(void)addPrintImage:(UIImage*)img; 118 | +(void)addItemLines:(NSArray*)headervalue;//打印多行商品列表 119 | //二维码或者一维码 text必须是英文字符 ,istwo=NO 打印一维码,text必须是12-13位数字 120 | +(void)addPrintBarcode:(NSString*)text isTwoDimensionalCode :(int)isTwo; 121 | //打印并清空前面添加的文字图片,如果返回NO则会缓存本次打印数据,nav用来push出打印机选择列表 122 | +(BOOL)startPrint:(UINavigationController*)nav; 123 | @end 124 | 125 | 126 | -------------------------------------------------------------------------------- /PrinterDemo/SVProgressHD/SVProgressHUD.bundle/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/SVProgressHD/SVProgressHUD.bundle/error.png -------------------------------------------------------------------------------- /PrinterDemo/SVProgressHD/SVProgressHUD.bundle/error@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/SVProgressHD/SVProgressHUD.bundle/error@2x.png -------------------------------------------------------------------------------- /PrinterDemo/SVProgressHD/SVProgressHUD.bundle/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/SVProgressHD/SVProgressHUD.bundle/success.png -------------------------------------------------------------------------------- /PrinterDemo/SVProgressHD/SVProgressHUD.bundle/success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/SVProgressHD/SVProgressHUD.bundle/success@2x.png -------------------------------------------------------------------------------- /PrinterDemo/SVProgressHD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVProgressHUD.h 3 | // 4 | // Created by Sam Vermette on 27.03.11. 5 | // Copyright 2011 Sam Vermette. All rights reserved. 6 | // 7 | // https://github.com/samvermette/SVProgressHUD 8 | // 9 | 10 | #import 11 | #import 12 | 13 | enum { 14 | SVProgressHUDMaskTypeNone = 1, // allow user interactions while HUD is displayed 15 | SVProgressHUDMaskTypeClear, // don't allow 16 | SVProgressHUDMaskTypeBlack, // don't allow and dim the UI in the back of the HUD 17 | SVProgressHUDMaskTypeGradient // don't allow and dim the UI with a a-la-alert-view bg gradient 18 | }; 19 | 20 | typedef NSUInteger SVProgressHUDMaskType; 21 | 22 | @interface SVProgressHUD : UIView 23 | 24 | + (void)show; 25 | + (void)showWithStatus:(NSString*)status; 26 | + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 27 | + (void)showWithMaskType:(SVProgressHUDMaskType)maskType; 28 | 29 | + (void)showSuccessWithStatus:(NSString*)string; 30 | + (void)showSuccessWithStatus:(NSString *)string duration:(NSTimeInterval)duration; 31 | + (void)showErrorWithStatus:(NSString *)string; 32 | + (void)showErrorWithStatus:(NSString *)string duration:(NSTimeInterval)duration; 33 | 34 | + (void)setStatus:(NSString*)string; // change the HUD loading status while it's showing 35 | 36 | + (void)dismiss; // simply dismiss the HUD with a fade+scale out animation 37 | + (void)dismissWithSuccess:(NSString*)successString; // also displays the success icon image 38 | + (void)dismissWithSuccess:(NSString*)successString afterDelay:(NSTimeInterval)seconds; 39 | + (void)dismissWithError:(NSString*)errorString; // also displays the error icon image 40 | + (void)dismissWithError:(NSString*)errorString afterDelay:(NSTimeInterval)seconds; 41 | 42 | + (BOOL)isVisible; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /PrinterDemo/SVProgressHD/SVProgressHUD.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVProgressHUD.m 3 | // 4 | // Created by Sam Vermette on 27.03.11. 5 | // Copyright 2011 Sam Vermette. All rights reserved. 6 | // 7 | // https://github.com/samvermette/SVProgressHUD 8 | // 9 | 10 | #import "SVProgressHUD.h" 11 | #import 12 | 13 | @interface SVProgressHUD () 14 | 15 | @property (nonatomic, readwrite) SVProgressHUDMaskType maskType; 16 | @property (nonatomic, strong, readonly) NSTimer *fadeOutTimer; 17 | 18 | @property (nonatomic, strong, readonly) UIWindow *overlayWindow; 19 | @property (nonatomic, strong, readonly) UIView *hudView; 20 | @property (nonatomic, strong, readonly) UILabel *stringLabel; 21 | @property (nonatomic, strong, readonly) UIImageView *imageView; 22 | @property (nonatomic, strong, readonly) UIActivityIndicatorView *spinnerView; 23 | 24 | @property (nonatomic, readonly) CGFloat visibleKeyboardHeight; 25 | 26 | - (void)showWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)hudMaskType networkIndicator:(BOOL)show; 27 | - (void)setStatus:(NSString*)string; 28 | - (void)registerNotifications; 29 | - (void)moveToPoint:(CGPoint)newCenter rotateAngle:(CGFloat)angle; 30 | - (void)positionHUD:(NSNotification*)notification; 31 | 32 | - (void)dismiss; 33 | - (void)dismissWithStatus:(NSString*)string error:(BOOL)error; 34 | - (void)dismissWithStatus:(NSString*)string error:(BOOL)error afterDelay:(NSTimeInterval)seconds; 35 | 36 | @end 37 | 38 | 39 | @implementation SVProgressHUD 40 | 41 | @synthesize overlayWindow, hudView, maskType, fadeOutTimer, stringLabel, imageView, spinnerView, visibleKeyboardHeight; 42 | 43 | - (void)dealloc { 44 | self.fadeOutTimer = nil; 45 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 46 | } 47 | 48 | 49 | + (SVProgressHUD*)sharedView { 50 | static dispatch_once_t once; 51 | static SVProgressHUD *sharedView; 52 | dispatch_once(&once, ^ { sharedView = [[SVProgressHUD alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; }); 53 | return sharedView; 54 | } 55 | 56 | 57 | + (void)setStatus:(NSString *)string { 58 | [[SVProgressHUD sharedView] setStatus:string]; 59 | } 60 | 61 | #pragma mark - Show Methods 62 | 63 | + (void)show { 64 | [[SVProgressHUD sharedView] showWithStatus:nil maskType:SVProgressHUDMaskTypeNone networkIndicator:NO]; 65 | } 66 | 67 | + (void)showWithStatus:(NSString *)status { 68 | [[SVProgressHUD sharedView] showWithStatus:status maskType:SVProgressHUDMaskTypeNone networkIndicator:NO]; 69 | } 70 | 71 | + (void)showWithMaskType:(SVProgressHUDMaskType)maskType { 72 | [[SVProgressHUD sharedView] showWithStatus:nil maskType:maskType networkIndicator:NO]; 73 | } 74 | 75 | + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType { 76 | [[SVProgressHUD sharedView] showWithStatus:status maskType:maskType networkIndicator:NO]; 77 | } 78 | 79 | + (void)showSuccessWithStatus:(NSString *)string { 80 | [SVProgressHUD showSuccessWithStatus:string duration:1]; 81 | } 82 | 83 | + (void)showSuccessWithStatus:(NSString *)string duration:(NSTimeInterval)duration { 84 | [SVProgressHUD show]; 85 | [SVProgressHUD dismissWithSuccess:string afterDelay:duration]; 86 | } 87 | 88 | + (void)showErrorWithStatus:(NSString *)string { 89 | [SVProgressHUD showErrorWithStatus:string duration:1]; 90 | } 91 | 92 | + (void)showErrorWithStatus:(NSString *)string duration:(NSTimeInterval)duration { 93 | [SVProgressHUD show]; 94 | [SVProgressHUD dismissWithError:string afterDelay:duration]; 95 | } 96 | 97 | 98 | #pragma mark - Dismiss Methods 99 | 100 | + (void)dismiss { 101 | [[SVProgressHUD sharedView] dismiss]; 102 | } 103 | 104 | + (void)dismissWithSuccess:(NSString*)successString { 105 | [[SVProgressHUD sharedView] dismissWithStatus:successString error:NO]; 106 | } 107 | 108 | + (void)dismissWithSuccess:(NSString *)successString afterDelay:(NSTimeInterval)seconds { 109 | [[SVProgressHUD sharedView] dismissWithStatus:successString error:NO afterDelay:seconds]; 110 | } 111 | 112 | + (void)dismissWithError:(NSString*)errorString { 113 | [[SVProgressHUD sharedView] dismissWithStatus:errorString error:YES]; 114 | } 115 | 116 | + (void)dismissWithError:(NSString *)errorString afterDelay:(NSTimeInterval)seconds { 117 | [[SVProgressHUD sharedView] dismissWithStatus:errorString error:YES afterDelay:seconds]; 118 | } 119 | 120 | 121 | #pragma mark - Instance Methods 122 | 123 | - (id)initWithFrame:(CGRect)frame { 124 | 125 | if ((self = [super initWithFrame:frame])) { 126 | self.userInteractionEnabled = NO; 127 | self.backgroundColor = [UIColor clearColor]; 128 | self.alpha = 0; 129 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 130 | } 131 | 132 | return self; 133 | } 134 | 135 | - (void)drawRect:(CGRect)rect { 136 | 137 | CGContextRef context = UIGraphicsGetCurrentContext(); 138 | 139 | switch (self.maskType) { 140 | 141 | case SVProgressHUDMaskTypeBlack: { 142 | [[UIColor colorWithWhite:0 alpha:0.5] set]; 143 | CGContextFillRect(context, self.bounds); 144 | break; 145 | } 146 | 147 | case SVProgressHUDMaskTypeGradient: { 148 | 149 | size_t locationsCount = 2; 150 | CGFloat locations[2] = {0.0f, 1.0f}; 151 | CGFloat colors[8] = {0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.75f}; 152 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 153 | CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, colors, locations, locationsCount); 154 | CGColorSpaceRelease(colorSpace); 155 | 156 | CGPoint center = CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2); 157 | float radius = MIN(self.bounds.size.width , self.bounds.size.height) ; 158 | CGContextDrawRadialGradient (context, gradient, center, 0, center, radius, kCGGradientDrawsAfterEndLocation); 159 | CGGradientRelease(gradient); 160 | 161 | break; 162 | } 163 | } 164 | } 165 | 166 | - (void)setStatus:(NSString *)string { 167 | 168 | CGFloat hudWidth = 100; 169 | CGFloat hudHeight = 100; 170 | CGFloat stringWidth = 0; 171 | CGFloat stringHeight = 0; 172 | CGRect labelRect = CGRectZero; 173 | 174 | if(string) { 175 | CGSize stringSize = [string sizeWithFont:self.stringLabel.font constrainedToSize:CGSizeMake(200, 300)]; 176 | stringWidth = stringSize.width; 177 | stringHeight = stringSize.height; 178 | hudHeight = 80+stringHeight; 179 | 180 | if(stringWidth > hudWidth) 181 | hudWidth = ceil(stringWidth/2)*2; 182 | 183 | if(hudHeight > 100) { 184 | labelRect = CGRectMake(12, 66, hudWidth, stringHeight); 185 | hudWidth+=24; 186 | } else { 187 | hudWidth+=24; 188 | labelRect = CGRectMake(0, 66, hudWidth, stringHeight); 189 | } 190 | } 191 | 192 | self.hudView.bounds = CGRectMake(0, 0, hudWidth, hudHeight); 193 | 194 | if(string) 195 | self.imageView.center = CGPointMake(CGRectGetWidth(self.hudView.bounds)/2, 36); 196 | else 197 | self.imageView.center = CGPointMake(CGRectGetWidth(self.hudView.bounds)/2, CGRectGetHeight(self.hudView.bounds)/2); 198 | 199 | self.stringLabel.hidden = NO; 200 | self.stringLabel.text = string; 201 | self.stringLabel.frame = labelRect; 202 | 203 | if(string) 204 | self.spinnerView.center = CGPointMake(ceil(CGRectGetWidth(self.hudView.bounds)/2)+0.5, 40.5); 205 | else 206 | self.spinnerView.center = CGPointMake(ceil(CGRectGetWidth(self.hudView.bounds)/2)+0.5, ceil(self.hudView.bounds.size.height/2)+0.5); 207 | } 208 | 209 | - (void)setFadeOutTimer:(NSTimer *)newTimer { 210 | 211 | if(fadeOutTimer) 212 | [fadeOutTimer invalidate], fadeOutTimer = nil; 213 | 214 | if(newTimer) 215 | fadeOutTimer = newTimer; 216 | } 217 | 218 | 219 | - (void)registerNotifications { 220 | [[NSNotificationCenter defaultCenter] addObserver:self 221 | selector:@selector(positionHUD:) 222 | name:UIApplicationDidChangeStatusBarOrientationNotification 223 | object:nil]; 224 | 225 | [[NSNotificationCenter defaultCenter] addObserver:self 226 | selector:@selector(positionHUD:) 227 | name:UIKeyboardWillHideNotification 228 | object:nil]; 229 | 230 | [[NSNotificationCenter defaultCenter] addObserver:self 231 | selector:@selector(positionHUD:) 232 | name:UIKeyboardDidHideNotification 233 | object:nil]; 234 | 235 | [[NSNotificationCenter defaultCenter] addObserver:self 236 | selector:@selector(positionHUD:) 237 | name:UIKeyboardWillShowNotification 238 | object:nil]; 239 | 240 | [[NSNotificationCenter defaultCenter] addObserver:self 241 | selector:@selector(positionHUD:) 242 | name:UIKeyboardDidShowNotification 243 | object:nil]; 244 | } 245 | 246 | 247 | - (void)positionHUD:(NSNotification*)notification { 248 | 249 | CGFloat keyboardHeight; 250 | double animationDuration; 251 | 252 | UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; 253 | 254 | if(notification) { 255 | NSDictionary* keyboardInfo = [notification userInfo]; 256 | CGRect keyboardFrame = [[keyboardInfo valueForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; 257 | animationDuration = [[keyboardInfo valueForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; 258 | 259 | if(notification.name == UIKeyboardWillShowNotification || notification.name == UIKeyboardDidShowNotification) { 260 | if(UIInterfaceOrientationIsPortrait(orientation)) 261 | keyboardHeight = keyboardFrame.size.height; 262 | else 263 | keyboardHeight = keyboardFrame.size.width; 264 | } else 265 | keyboardHeight = 0; 266 | } else { 267 | keyboardHeight = self.visibleKeyboardHeight; 268 | } 269 | 270 | CGRect orientationFrame = [UIScreen mainScreen].bounds; 271 | CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; 272 | 273 | if(UIInterfaceOrientationIsLandscape(orientation)) { 274 | float temp = orientationFrame.size.width; 275 | orientationFrame.size.width = orientationFrame.size.height; 276 | orientationFrame.size.height = temp; 277 | 278 | temp = statusBarFrame.size.width; 279 | statusBarFrame.size.width = statusBarFrame.size.height; 280 | statusBarFrame.size.height = temp; 281 | } 282 | 283 | CGFloat activeHeight = orientationFrame.size.height; 284 | 285 | if(keyboardHeight > 0) 286 | activeHeight += statusBarFrame.size.height*2; 287 | 288 | activeHeight -= keyboardHeight; 289 | CGFloat posY = floor(activeHeight*0.45); 290 | CGFloat posX = orientationFrame.size.width/2; 291 | 292 | CGPoint newCenter; 293 | CGFloat rotateAngle; 294 | 295 | switch (orientation) { 296 | case UIInterfaceOrientationPortraitUpsideDown: 297 | rotateAngle = M_PI; 298 | newCenter = CGPointMake(posX, orientationFrame.size.height-posY); 299 | break; 300 | case UIInterfaceOrientationLandscapeLeft: 301 | rotateAngle = -M_PI/2.0f; 302 | newCenter = CGPointMake(posY, posX); 303 | break; 304 | case UIInterfaceOrientationLandscapeRight: 305 | rotateAngle = M_PI/2.0f; 306 | newCenter = CGPointMake(orientationFrame.size.height-posY, posX); 307 | break; 308 | default: // as UIInterfaceOrientationPortrait 309 | rotateAngle = 0.0; 310 | newCenter = CGPointMake(posX, posY); 311 | break; 312 | } 313 | 314 | if(notification) { 315 | [UIView animateWithDuration:animationDuration 316 | delay:0 317 | options:UIViewAnimationOptionAllowUserInteraction 318 | animations:^{ 319 | [self moveToPoint:newCenter rotateAngle:rotateAngle]; 320 | } completion:NULL]; 321 | } 322 | 323 | else { 324 | [self moveToPoint:newCenter rotateAngle:rotateAngle]; 325 | } 326 | 327 | } 328 | 329 | - (void)moveToPoint:(CGPoint)newCenter rotateAngle:(CGFloat)angle { 330 | self.hudView.transform = CGAffineTransformMakeRotation(angle); 331 | self.hudView.center = newCenter; 332 | } 333 | 334 | #pragma mark - Master show/dismiss methods 335 | 336 | - (void)showWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)hudMaskType networkIndicator:(BOOL)show { 337 | dispatch_async(dispatch_get_main_queue(), ^{ 338 | if(!self.superview) 339 | [self.overlayWindow addSubview:self]; 340 | 341 | self.fadeOutTimer = nil; 342 | self.imageView.hidden = YES; 343 | self.maskType = hudMaskType; 344 | 345 | [self setStatus:string]; 346 | [self.spinnerView startAnimating]; 347 | 348 | if(self.maskType != SVProgressHUDMaskTypeNone) { 349 | self.overlayWindow.userInteractionEnabled = YES; 350 | } else { 351 | self.overlayWindow.userInteractionEnabled = NO; 352 | } 353 | 354 | [self.overlayWindow makeKeyAndVisible]; 355 | [self positionHUD:nil]; 356 | 357 | if(self.alpha != 1) { 358 | [self registerNotifications]; 359 | self.hudView.transform = CGAffineTransformScale(self.hudView.transform, 1.3, 1.3); 360 | 361 | [UIView animateWithDuration:0.15 362 | delay:0 363 | options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationCurveEaseOut | UIViewAnimationOptionBeginFromCurrentState 364 | animations:^{ 365 | self.hudView.transform = CGAffineTransformScale(self.hudView.transform, 1/1.3, 1/1.3); 366 | self.alpha = 1; 367 | } 368 | completion:NULL]; 369 | } 370 | 371 | [self setNeedsDisplay]; 372 | }); 373 | } 374 | 375 | 376 | - (void)dismissWithStatus:(NSString*)string error:(BOOL)error { 377 | [self dismissWithStatus:string error:error afterDelay:0.9]; 378 | } 379 | 380 | 381 | - (void)dismissWithStatus:(NSString *)string error:(BOOL)error afterDelay:(NSTimeInterval)seconds { 382 | dispatch_async(dispatch_get_main_queue(), ^{ 383 | if(self.alpha != 1) 384 | return; 385 | 386 | if(error) 387 | self.imageView.image = [UIImage imageNamed:@"SVProgressHUD.bundle/error.png"]; 388 | else 389 | self.imageView.image = [UIImage imageNamed:@"SVProgressHUD.bundle/success.png"]; 390 | 391 | self.imageView.hidden = NO; 392 | [self setStatus:string]; 393 | [self.spinnerView stopAnimating]; 394 | 395 | self.fadeOutTimer = [NSTimer scheduledTimerWithTimeInterval:seconds target:self selector:@selector(dismiss) userInfo:nil repeats:NO]; 396 | }); 397 | } 398 | 399 | - (void)dismiss { 400 | dispatch_async(dispatch_get_main_queue(), ^{ 401 | 402 | [UIView animateWithDuration:0.15 403 | delay:0 404 | options:UIViewAnimationCurveEaseIn | UIViewAnimationOptionAllowUserInteraction 405 | animations:^{ 406 | self.hudView.transform = CGAffineTransformScale(self.hudView.transform, 0.8, 0.8); 407 | self.alpha = 0; 408 | } 409 | completion:^(BOOL finished){ 410 | if(self.alpha == 0) { 411 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 412 | [hudView removeFromSuperview]; 413 | hudView = nil; 414 | 415 | // Make sure to remove the overlay window from the list of windows 416 | // before trying to find the key window in that same list 417 | NSMutableArray *windows = [[NSMutableArray alloc] initWithArray:[UIApplication sharedApplication].windows]; 418 | [windows removeObject:overlayWindow]; 419 | overlayWindow = nil; 420 | 421 | [windows enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(UIWindow *window, NSUInteger idx, BOOL *stop) { 422 | if([window isKindOfClass:[UIWindow class]] && window.windowLevel == UIWindowLevelNormal) { 423 | [window makeKeyWindow]; 424 | *stop = YES; 425 | } 426 | }]; 427 | 428 | // uncomment to make sure UIWindow is gone from app.windows 429 | //DDLog(@"%@", [UIApplication sharedApplication].windows); 430 | //DDLog(@"keyWindow = %@", [UIApplication sharedApplication].keyWindow); 431 | } 432 | }]; 433 | }); 434 | } 435 | 436 | #pragma mark - Utilities 437 | 438 | + (BOOL)isVisible { 439 | return ([SVProgressHUD sharedView].alpha == 1); 440 | } 441 | 442 | 443 | #pragma mark - Getters 444 | 445 | - (UIWindow *)overlayWindow { 446 | if(!overlayWindow) { 447 | overlayWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 448 | overlayWindow.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 449 | overlayWindow.backgroundColor = [UIColor clearColor]; 450 | overlayWindow.userInteractionEnabled = NO; 451 | } 452 | return overlayWindow; 453 | } 454 | 455 | - (UIView *)hudView { 456 | if(!hudView) { 457 | hudView = [[UIView alloc] initWithFrame:CGRectZero]; 458 | hudView.layer.cornerRadius = 10; 459 | hudView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8]; 460 | hudView.autoresizingMask = (UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | 461 | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin); 462 | 463 | [self addSubview:hudView]; 464 | } 465 | return hudView; 466 | } 467 | 468 | - (UILabel *)stringLabel { 469 | if (stringLabel == nil) { 470 | stringLabel = [[UILabel alloc] initWithFrame:CGRectZero]; 471 | stringLabel.textColor = [UIColor whiteColor]; 472 | stringLabel.backgroundColor = [UIColor clearColor]; 473 | stringLabel.adjustsFontSizeToFitWidth = YES; 474 | stringLabel.textAlignment = UITextAlignmentCenter; 475 | stringLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters; 476 | stringLabel.font = [UIFont boldSystemFontOfSize:16]; 477 | stringLabel.shadowColor = [UIColor blackColor]; 478 | stringLabel.shadowOffset = CGSizeMake(0, -1); 479 | stringLabel.numberOfLines = 0; 480 | } 481 | 482 | if(!stringLabel.superview) 483 | [self.hudView addSubview:stringLabel]; 484 | 485 | return stringLabel; 486 | } 487 | 488 | - (UIImageView *)imageView { 489 | if (imageView == nil) 490 | imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)]; 491 | 492 | if(!imageView.superview) 493 | [self.hudView addSubview:imageView]; 494 | 495 | return imageView; 496 | } 497 | 498 | - (UIActivityIndicatorView *)spinnerView { 499 | if (spinnerView == nil) { 500 | spinnerView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; 501 | spinnerView.hidesWhenStopped = YES; 502 | spinnerView.bounds = CGRectMake(0, 0, 37, 37); 503 | } 504 | 505 | if(!spinnerView.superview) 506 | [self.hudView addSubview:spinnerView]; 507 | 508 | return spinnerView; 509 | } 510 | 511 | - (CGFloat)visibleKeyboardHeight { 512 | 513 | UIWindow *keyboardWindow = nil; 514 | for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) { 515 | if(![[testWindow class] isEqual:[UIWindow class]]) { 516 | keyboardWindow = testWindow; 517 | break; 518 | } 519 | } 520 | 521 | // Locate UIKeyboard. 522 | UIView *foundKeyboard = nil; 523 | for (__strong UIView *possibleKeyboard in [keyboardWindow subviews]) { 524 | 525 | // iOS 4 sticks the UIKeyboard inside a UIPeripheralHostView. 526 | if ([[possibleKeyboard description] hasPrefix:@" 100) 537 | return foundKeyboard.bounds.size.height; 538 | 539 | return 0; 540 | } 541 | 542 | @end 543 | -------------------------------------------------------------------------------- /PrinterDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 15/9/14. 6 | // Copyright (c) 2015年 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /PrinterDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 15/9/14. 6 | // Copyright (c) 2015年 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | @interface ViewController () 11 | 12 | @end 13 | 14 | @implementation ViewController 15 | 16 | - (void)viewDidLoad { 17 | [super viewDidLoad]; 18 | // Do any additional setup after loading the view, typically from a nib. 19 | // self.navigationController =[[UINavigationController alloc] initWithRootViewController:self]; 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /PrinterDemo/ico180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/ico180.png -------------------------------------------------------------------------------- /PrinterDemo/libPrinterSDK.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knightSaber/PrinterDemoDev/65a3388fb224348d590c64a6ead677ccffa124bc/PrinterDemo/libPrinterSDK.a -------------------------------------------------------------------------------- /PrinterDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 15/9/14. 6 | // Copyright (c) 2015年 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PrinterDemo/setting/FormatSettingTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FormatSettingTableViewController.h 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 9/30/15. 6 | // Copyright © 2015 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "PrinterSDK.h" 12 | 13 | #define ITEMS_PRODUCT_KEY @[@"styenum",@"name",@"code",@"extra1",@"extra2",@"spec",@"count",@"unit",@"price",@"xiaoji"] 14 | 15 | 16 | #define ITEMS_PRODUCT_VALUE @[NSLocalizedString(@"款号", @""),NSLocalizedString(@"名称", @""),NSLocalizedString(@"条码", @""),@"xx",@"yy",NSLocalizedString(@"规格", @""),NSLocalizedString(@"数量", @""),NSLocalizedString(@"单位", @""),NSLocalizedString(@"价格", @""),NSLocalizedString(@"小计", @"")] 17 | 18 | 19 | @interface FormatSettingTableViewController : UITableViewController 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /PrinterDemo/setting/FormatSettingTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FormatSettingTableViewController.m 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 9/30/15. 6 | // Copyright © 2015 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import "FormatSettingTableViewController.h" 10 | #import "ValueEditViewController.h" 11 | //#import "HjTools.h" 12 | @interface FormatSettingTableViewController () 13 | { 14 | UIPickerView *pick; 15 | UIButton *okbtn; 16 | UIButton *cancelbtn; 17 | NSMutableDictionary *settingDictionary; 18 | NSArray *TextIndexarray; 19 | NSArray *TextIndexarrayCN; 20 | 21 | NSArray *ButtonIndexarray; 22 | NSArray *ButtonIndexarrayCN; 23 | 24 | NSArray *printtypeArr; 25 | NSArray *printFontArr; 26 | NSString *choosedKeyword; 27 | } 28 | @end 29 | 30 | @implementation FormatSettingTableViewController 31 | 32 | - (void)viewDidLoad { 33 | [super viewDidLoad]; 34 | 35 | // Uncomment the following line to preserve selection between presentations. 36 | // self.clearsSelectionOnViewWillAppear = NO; 37 | 38 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 39 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 40 | // UIBarButtonItem*rightbaritem=[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"保存", @"") style:UIBarButtonItemStyleBordered target:self action:@selector(rightbarPress)]; 41 | // self.navigationItem.rightBarButtonItem = rightbaritem; 42 | 43 | 44 | //NSLocalizedString(@"公司图标", @"") logo 45 | TextIndexarray = @[@"printertype", @"printerfontsize",@"copycount",@"autoprint",@"printphone",@"company",@"operater",@"welcome",@"barcode"]; 46 | TextIndexarrayCN =@[ NSLocalizedString(@"打印机宽度", @""), NSLocalizedString(@"字体大小", @""),NSLocalizedString(@"打印联数", @""),NSLocalizedString(@"保存后自动打印", @""),NSLocalizedString(@"打印客户详情", @""), NSLocalizedString(@"公司名称", @""), NSLocalizedString(@"开单员", @""), NSLocalizedString(@"页脚", @""), NSLocalizedString(@"二维码", @""),]; 47 | 48 | 49 | ButtonIndexarray = ITEMS_PRODUCT_KEY; 50 | ButtonIndexarrayCN = ITEMS_PRODUCT_VALUE; 51 | 52 | printtypeArr = @[@"58mm",@"80mm",@"110mm",NSLocalizedString(@"针式210mm",@""),@"AirPrint 210mm"]; 53 | printFontArr = @[NSLocalizedString(@"自动", @""),NSLocalizedString(@"小字体", @""),NSLocalizedString(@"中字体", @""),NSLocalizedString(@"大字体", @"")]; 54 | } 55 | -(void)viewWillAppear:(BOOL)animated 56 | { 57 | NSDictionary *saved= [PrinterWraper getPrinterSetting]; 58 | settingDictionary =[NSMutableDictionary dictionaryWithDictionary:saved]; 59 | [self.tableView reloadData]; 60 | [self saveChange]; 61 | } 62 | - (void)didReceiveMemoryWarning { 63 | [super didReceiveMemoryWarning]; 64 | // Dispose of any resources that can be recreated. 65 | } 66 | -(void)rightbarPress{ 67 | 68 | [self saveChange]; 69 | [self.navigationController popViewControllerAnimated:YES]; 70 | } 71 | -(void)saveChange{ 72 | [PrinterWraper setPrinterSetting:settingDictionary]; 73 | 74 | } 75 | #pragma mark - Table view data source 76 | 77 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 78 | //#warning Incomplete implementation, return the number of sections 79 | return 2; 80 | } 81 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 82 | { 83 | return 44; 84 | } 85 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section; 86 | { 87 | return 44; 88 | } 89 | 90 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 91 | //#warning Incomplete implementation, return the number of rows 92 | if (section == 0) { 93 | return TextIndexarray.count; 94 | }else 95 | return ButtonIndexarray.count; 96 | } 97 | -(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 98 | { 99 | if (section == 0) { 100 | return NSLocalizedString(@"表头表尾打印内容", @""); 101 | }else if(section == 1) 102 | return NSLocalizedString(@"商品信息打印项目", @""); 103 | return nil; 104 | } 105 | 106 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 107 | if (indexPath.section == 0) { 108 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"settingindentify" ]; 109 | if (!cell) { 110 | cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"settingindentify"]; 111 | } 112 | NSString *keyword = TextIndexarray[indexPath.row]; 113 | cell.textLabel.text = TextIndexarrayCN[indexPath.row]; 114 | if ([keyword isEqualToString:@"printertype"]) { 115 | NSNumber * index = [settingDictionary objectForKey:keyword]; 116 | cell.detailTextLabel.text = printtypeArr[[index integerValue]]; 117 | 118 | }else if ( [keyword isEqualToString:@"printerfontsize"]) 119 | { 120 | NSNumber * index = [settingDictionary objectForKey:keyword]; 121 | cell.detailTextLabel.text = printFontArr[[index integerValue]]; 122 | }else if ( [keyword isEqualToString:@"copycount"]) 123 | { 124 | NSNumber * index = [settingDictionary objectForKey:keyword]; 125 | cell.detailTextLabel.text = [NSString stringWithFormat:@"%d",[index intValue]+1]; 126 | 127 | }else if ( [keyword isEqualToString:@"autoprint"] || [keyword isEqualToString:@"printphone"]) 128 | { 129 | NSNumber * index = [settingDictionary objectForKey:keyword]; 130 | if ([index intValue]==0) { 131 | cell.detailTextLabel.text =NSLocalizedString(@"否", @""); 132 | }else 133 | cell.detailTextLabel.text =NSLocalizedString(@"是", @""); 134 | 135 | }else if ([keyword isEqualToString:@"logo"]){ 136 | 137 | } 138 | else 139 | cell.detailTextLabel.text = settingDictionary[keyword]; 140 | 141 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 142 | return cell; 143 | 144 | 145 | }else 146 | { 147 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"settingproductindentify" ]; 148 | if (!cell) { 149 | cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"settingproductindentify"]; 150 | } 151 | NSString *keyword = ButtonIndexarray[indexPath.row]; 152 | cell.textLabel.text = ButtonIndexarrayCN[indexPath.row]; 153 | NSNumber *check=[settingDictionary objectForKey:keyword]; 154 | if ([check boolValue]) { 155 | cell.accessoryType = UITableViewCellAccessoryCheckmark; 156 | }else 157 | cell.accessoryType = UITableViewCellAccessoryNone; 158 | return cell; 159 | 160 | } 161 | // Configure the cell... 162 | 163 | } 164 | 165 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; 166 | { 167 | choosedKeyword = nil; 168 | if (indexPath.section == 0) { 169 | 170 | NSString *keyword = TextIndexarray[indexPath.row]; 171 | 172 | // NSString *value=[settingDictionary objectForKey:keyword]; 173 | if (indexPath.row < 5) { 174 | choosedKeyword =keyword; 175 | [self showActionSheet]; 176 | }else 177 | { 178 | 179 | ValueEditViewController *detail =[[ValueEditViewController alloc ] init]; 180 | detail.title =TextIndexarrayCN[indexPath.row]; 181 | detail.keyword = keyword; 182 | [self.navigationController pushViewController:detail animated:YES]; 183 | } 184 | 185 | }else if(indexPath.section == 1){ 186 | NSString *keyword = ButtonIndexarray[indexPath.row]; 187 | 188 | NSNumber *check=[settingDictionary objectForKey:keyword]; 189 | check =[NSNumber numberWithBool:![check boolValue]]; 190 | [settingDictionary setObject:check forKey:keyword]; 191 | [self.tableView reloadData]; 192 | 193 | [self saveChange]; 194 | } 195 | 196 | } 197 | #pragma mark sheet 198 | -(void)showActionSheet{ 199 | 200 | UIActionSheet *action =[[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"请选择", @"") delegate:self cancelButtonTitle:NSLocalizedString(@"取消", @"") destructiveButtonTitle:nil otherButtonTitles:nil, nil]; 201 | NSArray *tmp; 202 | if ([choosedKeyword isEqualToString:@"printertype"] ) { 203 | tmp =printtypeArr; 204 | } 205 | if ([choosedKeyword isEqualToString:@"printerfontsize"]) { 206 | tmp = printFontArr; 207 | } 208 | if ([choosedKeyword isEqualToString:@"copycount"]) { 209 | tmp =@[@"1",@"2",@"3"]; 210 | } 211 | if ([choosedKeyword isEqualToString:@"autoprint"]) { 212 | tmp =@[NSLocalizedString(@"否",@""),NSLocalizedString(@"是",@"")]; 213 | } 214 | if ([choosedKeyword isEqualToString:@"printphone"]) { 215 | tmp =@[NSLocalizedString(@"否",@""),NSLocalizedString(@"是",@"")]; 216 | } 217 | for (NSString *item in tmp) { 218 | [action addButtonWithTitle:item]; 219 | } 220 | [action showInView:self.view]; 221 | } 222 | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex NS_DEPRECATED_IOS(2_0, 8_3); 223 | { 224 | 225 | if (buttonIndex > 0) { 226 | buttonIndex--; 227 | 228 | NSNumber * printertype =[NSNumber numberWithInteger:buttonIndex]; 229 | [settingDictionary setObject:printertype forKey:choosedKeyword]; 230 | [self.tableView reloadData]; 231 | [self saveChange]; 232 | } 233 | 234 | } 235 | #pragma mark pick 236 | 237 | @end 238 | -------------------------------------------------------------------------------- /PrinterDemo/setting/PrinterListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PrinterListViewController.h 3 | // PrinterSDK 4 | // 5 | // Created by doulai on 9/16/15. 6 | // Copyright (c) 2015 doulai. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FormatSettingTableViewController.h" 11 | @interface PrinterListViewController : UIViewController 12 | @property BOOL hasTask; 13 | 14 | //@property NSString*printeruid; 15 | @property printModel *taskmodel; 16 | @end 17 | -------------------------------------------------------------------------------- /PrinterDemo/setting/PrinterListViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PrinterListViewController.m 3 | // PrinterSDK 4 | // 5 | // Created by doulai on 9/16/15. 6 | // Copyright (c) 2015 doulai. All rights reserved. 7 | // 8 | 9 | #import "PrinterListViewController.h" 10 | #import "FormatSettingTableViewController.h" 11 | 12 | //#import "VirturePrinter.h" 13 | 14 | #import 15 | //#import "CustomerPrintViewController.h" 16 | 17 | @interface PrinterListViewController () 18 | { 19 | NSArray*deviceList; 20 | // NSDictionary*connetedDevice; 21 | NSInteger choosedIndex; 22 | // VirturePrinter*printDevice; 23 | NSTimer* mytimer; 24 | UIActivityIndicatorView *activityView; 25 | UITableView *mytableview; 26 | } 27 | 28 | 29 | @end 30 | //static NSString*printertableIdentify=@"printertableIdentify"; 31 | @implementation PrinterListViewController 32 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 33 | { 34 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 35 | if (self) { 36 | // Custom initialization 37 | } 38 | return self; 39 | } 40 | 41 | - (void)viewDidLoad 42 | { 43 | [super viewDidLoad]; 44 | // Do any additional setup after loading the view from its nib. 45 | 46 | self.edgesForExtendedLayout=UIRectEdgeNone; 47 | 48 | self.hidesBottomBarWhenPushed=YES; 49 | self.title=NSLocalizedString(@"配置打印机", @""); 50 | [self.view setBackgroundColor:[UIColor whiteColor]]; 51 | // NSDictionary*configure=[[NSUserDefaults standardUserDefaults] objectForKey:@"dashixiongprintersdk"]; 52 | // NSNumber*hideConfigure=[configure objectForKey:@"hideConfigure"]; 53 | int height =12; 54 | // if ([hideConfigure integerValue] !=1 ) 55 | { 56 | UIButton *selfprint = [[UIButton alloc] initWithFrame:CGRectMake(8, height, 150, 44)]; 57 | [selfprint setTitle:NSLocalizedString(@"查看淘宝打印机", @"") forState:UIControlStateNormal]; 58 | [selfprint addTarget:self action:@selector(openTaobao:) forControlEvents:UIControlEventTouchUpInside]; 59 | [selfprint setBackgroundColor:[UIColor orangeColor]]; 60 | [selfprint setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 61 | [self.view addSubview:selfprint]; 62 | 63 | UIButton *formatbtn = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width- 8-150, height, 150, 44)]; 64 | [formatbtn setTitle:NSLocalizedString(@"设置打印模版", @"") forState:UIControlStateNormal]; 65 | [formatbtn addTarget:self action:@selector(openFormat:) forControlEvents:UIControlEventTouchUpInside]; 66 | [formatbtn setBackgroundColor:[UIColor orangeColor]]; 67 | [formatbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 68 | [self.view addSubview:formatbtn]; 69 | 70 | height +=44+12; 71 | 72 | } 73 | 74 | 75 | 76 | 77 | UILabel *chooselbl=[[UILabel alloc] initWithFrame:CGRectMake(8, height, 200, 21)]; 78 | chooselbl.text = NSLocalizedString(@"打印机列表", @""); 79 | [self.view addSubview:chooselbl]; 80 | 81 | height +=21+12; 82 | mytableview = [[UITableView alloc] initWithFrame:CGRectMake(0, height, self.view.frame.size.width, self.view.frame.size.height- height)]; 83 | mytableview.delegate =self; 84 | mytableview.dataSource =self; 85 | mytableview.tag =2; 86 | [self.view addSubview:mytableview]; 87 | 88 | 89 | // [PrinterWraper getPrinterSetting]; 90 | 91 | // printDevice = [VirturePrinter createPrinterDevice:@"bluetooth"]; 92 | // printDevice.delegate=self; 93 | // deviceList = [printDevice getScanedPrinterList]; 94 | choosedIndex = -1; 95 | } 96 | 97 | -(void)viewWillAppear:(BOOL)animated{ 98 | [super viewWillAppear:animated]; 99 | 100 | 101 | 102 | [self scanPrinter:nil ]; 103 | 104 | 105 | 106 | [mytableview reloadData]; 107 | 108 | } 109 | -(void)viewWillDisappear:(BOOL)animated{ 110 | [super viewWillDisappear:animated]; 111 | 112 | [self stopScan]; 113 | [PrinterWraper SetBlutoothDelegate:nil]; 114 | 115 | } 116 | #pragma mark 按钮 117 | -(void)selfprint:(id)sender 118 | { 119 | // CustomerPrintViewController *detail=[[CustomerPrintViewController alloc] init]; 120 | // detail.title = NSLocalizedString(@"打印自定义内容", @""); 121 | // BOOL hide= self.hidesBottomBarWhenPushed ; 122 | // self.hidesBottomBarWhenPushed = YES; 123 | // [self.navigationController pushViewController:detail animated:YES]; 124 | // self.hidesBottomBarWhenPushed = hide; 125 | 126 | } 127 | -(void)openTaobao:(id)sender 128 | { 129 | // NSString *customURL = @"taobao://shop113684150.taobao.com/"; 130 | NSString *customURL=@"http://item.taobao.com/item.htm?id=44696180568"; 131 | 132 | if ([[UIApplication sharedApplication] 133 | canOpenURL:[NSURL URLWithString:customURL]]) 134 | { 135 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]]; 136 | }else 137 | { 138 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://shop113684150.taobao.com"]]; 139 | } 140 | } 141 | -(void)openFormat:(id)sender 142 | { 143 | FormatSettingTableViewController *detail=[[FormatSettingTableViewController alloc] init]; 144 | detail.title = NSLocalizedString(@"设置打印模版", @""); 145 | BOOL hide= self.hidesBottomBarWhenPushed ; 146 | self.hidesBottomBarWhenPushed = YES; 147 | [self.navigationController pushViewController:detail animated:YES]; 148 | self.hidesBottomBarWhenPushed = hide; 149 | 150 | } 151 | -(void)printTypeChanged:(UISegmentedControl*)sender 152 | { 153 | 154 | } 155 | - (void)scanPrinter:(id)sender { 156 | //clean 157 | // [self stopScan]; 158 | 159 | [PrinterWraper SetBlutoothDelegate:self]; 160 | [PrinterWraper StartScanTimeout:10]; 161 | 162 | mytimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(timeout) userInfo:nil repeats:NO]; 163 | activityView=[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 164 | 165 | activityView.center=self.view.center; 166 | 167 | [activityView startAnimating]; 168 | 169 | [self.view addSubview:activityView]; 170 | 171 | 172 | } 173 | -(void)stopScan{ 174 | [PrinterWraper StopScan]; 175 | [activityView stopAnimating]; 176 | [mytimer invalidate]; 177 | mytimer=nil; 178 | } 179 | -(void)timeout{ 180 | [self stopScan]; 181 | if (deviceList.count==0) 182 | { 183 | 184 | UIAlertView*alert=[[UIAlertView alloc] initWithTitle:nil message:NSLocalizedString(@"没有扫描到专用打印机,只支持iphone4s或者new pad及以后的苹果设备",@"") delegate:nil cancelButtonTitle:NSLocalizedString(@"确定", @"") otherButtonTitles:nil, nil]; 185 | [alert show]; 186 | } 187 | } 188 | - (void)didReceiveMemoryWarning 189 | { 190 | [super didReceiveMemoryWarning]; 191 | // Dispose of any resources that can be recreated. 192 | } 193 | 194 | 195 | 196 | #pragma mark bluetooth delegate 197 | -(void)BlueToothOpen:(BOOL)isopen;{ 198 | if (!isopen) { 199 | [self stopScan]; 200 | deviceList=nil; 201 | choosedIndex= -1; 202 | [mytableview reloadData]; 203 | // UIAlertView*alert=[[UIAlertView alloc] initWithTitle:nil message:NSLocalizedString(@"请在手机设置-》蓝牙 中打开蓝牙设备",@"") delegate:nil cancelButtonTitle:NSLocalizedString(@"确定", @"") otherButtonTitles:nil, nil]; 204 | // [alert show]; 205 | } 206 | } 207 | 208 | -(void)updateBluetoothDevice:(NSMutableArray*)devices; 209 | { 210 | deviceList =devices; 211 | 212 | [mytableview reloadData]; 213 | } 214 | 215 | -(void)didConnected:(NSString*)deviceUid Result:(BOOL)success;{ 216 | // [SVProgressHUD dismiss]; 217 | 218 | [mytableview reloadData]; 219 | 220 | if (success) 221 | [self excuteTask]; 222 | 223 | 224 | 225 | } 226 | -(void)finishPrint{ 227 | // DDLog(@"完成打印"); 228 | } 229 | #pragma mark task 230 | -(void)excuteTask{ 231 | NSString*info; 232 | if (self.hasTask ||self.taskmodel) { 233 | info=NSLocalizedString(@"连接成功,立即打印单据吗",@"") ; 234 | }else 235 | info=NSLocalizedString(@"恭喜您连接成功,是否检测打印效果?",@"") ; 236 | UIAlertView*alert=[[UIAlertView alloc] initWithTitle:nil message:info delegate:self cancelButtonTitle:NSLocalizedString(@"取消", @"") otherButtonTitles:NSLocalizedString(@"确定", @""), nil]; 237 | [alert show]; 238 | } 239 | 240 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; 241 | { 242 | 243 | if (buttonIndex==1) { 244 | if (self.hasTask) { 245 | [PrinterWraper startPrint:nil]; 246 | self.hasTask =NO; 247 | // [PrinterWraper printDictionary:self.task fromviewc:nil printeruid:nil needPreview:NO]; 248 | // self.task=nil; 249 | [self.navigationController popViewControllerAnimated:YES]; 250 | }else if(self.taskmodel) 251 | { 252 | [PrinterWraper printModel:self.taskmodel fromviewc:nil printeruid:nil preview:NO failed:nil]; 253 | self.taskmodel=nil; 254 | [self.navigationController popViewControllerAnimated:YES]; 255 | } 256 | else 257 | { 258 | // NSDictionary*oneOder=@{@"title":@"Sale",@"time": [NSDate date],@"buyer":@"customer",@"payedmoney":[NSNumber numberWithFloat:1000],@"sum":[NSNumber numberWithFloat:1000],@"historymoney":[NSNumber numberWithFloat:0]}; 259 | // [PrinterWraper printDictionary:oneOder fromviewc:nil printeruid:nil needPreview:NO]; 260 | [PrinterWraper addPrintText:@"掌上开单\n掌上开单\n掌上开单\n掌上开单\nSmart Invoice\nSmart Invoice\nSmart Invoice\n\n\n\n"]; 261 | [PrinterWraper startPrint:nil]; 262 | 263 | } 264 | }else 265 | { 266 | //dis 267 | // [printDevice disconnectPrinter:nil]; 268 | } 269 | } 270 | #pragma mark table 271 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; 272 | { 273 | return 54; 274 | } 275 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; 276 | { 277 | 278 | return deviceList.count; 279 | 280 | } 281 | // Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier: 282 | // Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls) 283 | 284 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 285 | { 286 | 287 | UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"tablecellindentify"]; 288 | if (!cell) { 289 | cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"tablecellindentify"]; 290 | } 291 | CBPeripheral *device=[deviceList objectAtIndex:indexPath.row]; 292 | NSString*name= device.name.length>0?device.name:NSLocalizedString(@"未知设备", @""); 293 | cell.textLabel.text=name; 294 | cell.detailTextLabel.text = NSLocalizedString(@"点击连接",@""); 295 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 296 | return cell; 297 | } 298 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; 299 | { 300 | 301 | CBPeripheral *device=[deviceList objectAtIndex:indexPath.row]; 302 | choosedIndex =indexPath.row; 303 | // [PrinterWraper disconnectPrinter:nil]; 304 | [PrinterWraper connectPrinter:device.identifier.UUIDString shouldreset:YES]; 305 | 306 | 307 | 308 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 309 | } 310 | 311 | @end 312 | 313 | -------------------------------------------------------------------------------- /PrinterDemo/setting/ValueEditViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ValueEditViewController.h 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 10/1/15. 6 | // Copyright © 2015 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ValueEditViewController : UIViewController 12 | @property (nonatomic,strong) NSString *keyword; 13 | @end 14 | -------------------------------------------------------------------------------- /PrinterDemo/setting/ValueEditViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ValueEditViewController.m 3 | // PrinterDemo 4 | // 5 | // Created by doulai on 10/1/15. 6 | // Copyright © 2015 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import "ValueEditViewController.h" 10 | #import "FormatSettingTableViewController.h" 11 | @interface ValueEditViewController () 12 | { 13 | NSMutableDictionary *settingDictionary; 14 | UITextView *textview ; 15 | } 16 | @end 17 | 18 | @implementation ValueEditViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view. 23 | // if (IOS7) { 24 | self.edgesForExtendedLayout=UIRectEdgeNone; 25 | // } 26 | [self.view setBackgroundColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1]]; 27 | textview =[[UITextView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)]; 28 | textview.editable =YES; 29 | [self.view addSubview:textview]; 30 | UILabel *tips = [[UILabel alloc] initWithFrame:CGRectMake(12, 212, self.view.frame.size.width-12, 21)]; 31 | tips.text = @""; 32 | if ([self.keyword isEqualToString:@"barcode"]) { 33 | tips.text = NSLocalizedString(@"请输入二维码链接地址,可以使用扫码功能获取", @""); 34 | } 35 | [self.view addSubview:tips]; 36 | UIBarButtonItem*rightbaritem=[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"保存", @"") style:UIBarButtonItemStyleBordered target:self action:@selector(rightbarPress)]; 37 | self.navigationItem.rightBarButtonItem = rightbaritem; 38 | 39 | NSDictionary *saved=[PrinterWraper getPrinterSetting];; 40 | settingDictionary =[NSMutableDictionary dictionaryWithDictionary:saved]; 41 | 42 | NSString *valuetext=[settingDictionary objectForKey:self.keyword]; 43 | textview.text =valuetext; 44 | 45 | 46 | } 47 | 48 | - (void)didReceiveMemoryWarning { 49 | [super didReceiveMemoryWarning]; 50 | // Dispose of any resources that can be recreated. 51 | } 52 | -(void)rightbarPress{ 53 | NSString *value =textview.text; 54 | if (value && self.keyword) { 55 | [settingDictionary setObject:textview.text forKey:self.keyword]; 56 | [PrinterWraper setPrinterSetting:settingDictionary]; 57 | } 58 | 59 | 60 | [self.navigationController popViewControllerAnimated:YES]; 61 | } 62 | /* 63 | #pragma mark - Navigation 64 | 65 | // In a storyboard-based application, you will often want to do a little preparation before navigation 66 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 67 | // Get the new view controller using [segue destinationViewController]. 68 | // Pass the selected object to the new view controller. 69 | } 70 | */ 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /PrinterDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.cmcc.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /PrinterDemoTests/PrinterDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PrinterDemoTests.m 3 | // PrinterDemoTests 4 | // 5 | // Created by doulai on 15/9/14. 6 | // Copyright (c) 2015年 com.cmcc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface PrinterDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation PrinterDemoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | --------------------------------------------------------------------------------