├── LICENSE ├── NumberCalculate.podspec ├── NumberCalculate.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── singularity.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── NumberCalculate ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── NumberCalculate │ ├── NumberCalculate.h │ ├── NumberCalculate.m │ └── resource │ │ ├── btn_num_add@2x.png │ │ ├── btn_num_add@3x.png │ │ ├── btn_num_minus@2x.png │ │ └── btn_num_minus@3x.png ├── TableViewCell.h ├── TableViewCell.m ├── TableViewCell.xib ├── ViewController.h ├── ViewController.m └── main.m ├── NumberCalculateTests ├── Info.plist └── NumberCalculateTests.m ├── NumberCalculateUITests ├── Info.plist └── NumberCalculateUITests.m ├── README.md └── screen.gif /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 XueYangLee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NumberCalculate.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "NumberCalculate" 5 | s.version = "0.0.2" 6 | s.summary = "数值加减小控件" 7 | s.homepage = "https://github.com/XueYangLee/NumberCalculate" 8 | s.license = "MIT" 9 | s.author = { "Singularity_Lee" => "496736912@qq.com" } 10 | s.platform = :ios, "8.0" 11 | s.source = { :git => "https://github.com/XueYangLee/NumberCalculate.git", :tag => s.version} 12 | s.source_files = "NumberCalculate/NumberCalculate/*.{h,m}" 13 | s.resources = "NumberCalculate/NumberCalculate/resource/*.png" 14 | s.requires_arc = true 15 | 16 | 17 | end 18 | -------------------------------------------------------------------------------- /NumberCalculate.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F152AA6B20BFCC4500EE09EC /* TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F152AA6920BFCC4500EE09EC /* TableViewCell.m */; }; 11 | F152AA6C20BFCC4500EE09EC /* TableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F152AA6A20BFCC4500EE09EC /* TableViewCell.xib */; }; 12 | F18AA46220BCE9450012D972 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F18AA46120BCE9450012D972 /* AppDelegate.m */; }; 13 | F18AA46520BCE9450012D972 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F18AA46420BCE9450012D972 /* ViewController.m */; }; 14 | F18AA46820BCE9450012D972 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F18AA46620BCE9450012D972 /* Main.storyboard */; }; 15 | F18AA46A20BCE9460012D972 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F18AA46920BCE9460012D972 /* Assets.xcassets */; }; 16 | F18AA46D20BCE9460012D972 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F18AA46B20BCE9460012D972 /* LaunchScreen.storyboard */; }; 17 | F18AA47020BCE9460012D972 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F18AA46F20BCE9460012D972 /* main.m */; }; 18 | F18AA47A20BCE9460012D972 /* NumberCalculateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F18AA47920BCE9460012D972 /* NumberCalculateTests.m */; }; 19 | F18AA48520BCE9460012D972 /* NumberCalculateUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = F18AA48420BCE9460012D972 /* NumberCalculateUITests.m */; }; 20 | F18AA49520BCEAC50012D972 /* NumberCalculate.m in Sources */ = {isa = PBXBuildFile; fileRef = F18AA49420BCEAC50012D972 /* NumberCalculate.m */; }; 21 | F18AA49920BD4AB40012D972 /* btn_num_add@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F18AA49720BD4AB40012D972 /* btn_num_add@2x.png */; }; 22 | F18AA49A20BD4AB40012D972 /* btn_num_add@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = F18AA49820BD4AB40012D972 /* btn_num_add@3x.png */; }; 23 | F18AA49D20BD4ABD0012D972 /* btn_num_minus@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = F18AA49B20BD4ABD0012D972 /* btn_num_minus@3x.png */; }; 24 | F18AA49E20BD4ABD0012D972 /* btn_num_minus@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F18AA49C20BD4ABD0012D972 /* btn_num_minus@2x.png */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | F18AA47620BCE9460012D972 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = F18AA45520BCE9450012D972 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = F18AA45C20BCE9450012D972; 33 | remoteInfo = NumberCalculate; 34 | }; 35 | F18AA48120BCE9460012D972 /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = F18AA45520BCE9450012D972 /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = F18AA45C20BCE9450012D972; 40 | remoteInfo = NumberCalculate; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | F152AA6820BFCC4500EE09EC /* TableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TableViewCell.h; sourceTree = ""; }; 46 | F152AA6920BFCC4500EE09EC /* TableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TableViewCell.m; sourceTree = ""; }; 47 | F152AA6A20BFCC4500EE09EC /* TableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TableViewCell.xib; sourceTree = ""; }; 48 | F18AA45D20BCE9450012D972 /* NumberCalculate.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NumberCalculate.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | F18AA46020BCE9450012D972 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | F18AA46120BCE9450012D972 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 51 | F18AA46320BCE9450012D972 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 52 | F18AA46420BCE9450012D972 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 53 | F18AA46720BCE9450012D972 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 54 | F18AA46920BCE9460012D972 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 55 | F18AA46C20BCE9460012D972 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 56 | F18AA46E20BCE9460012D972 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | F18AA46F20BCE9460012D972 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 58 | F18AA47520BCE9460012D972 /* NumberCalculateTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NumberCalculateTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | F18AA47920BCE9460012D972 /* NumberCalculateTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NumberCalculateTests.m; sourceTree = ""; }; 60 | F18AA47B20BCE9460012D972 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 61 | F18AA48020BCE9460012D972 /* NumberCalculateUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NumberCalculateUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | F18AA48420BCE9460012D972 /* NumberCalculateUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NumberCalculateUITests.m; sourceTree = ""; }; 63 | F18AA48620BCE9460012D972 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | F18AA49320BCEAC50012D972 /* NumberCalculate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NumberCalculate.h; sourceTree = ""; }; 65 | F18AA49420BCEAC50012D972 /* NumberCalculate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NumberCalculate.m; sourceTree = ""; }; 66 | F18AA49720BD4AB40012D972 /* btn_num_add@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_num_add@2x.png"; sourceTree = ""; }; 67 | F18AA49820BD4AB40012D972 /* btn_num_add@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_num_add@3x.png"; sourceTree = ""; }; 68 | F18AA49B20BD4ABD0012D972 /* btn_num_minus@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_num_minus@3x.png"; sourceTree = ""; }; 69 | F18AA49C20BD4ABD0012D972 /* btn_num_minus@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_num_minus@2x.png"; sourceTree = ""; }; 70 | /* End PBXFileReference section */ 71 | 72 | /* Begin PBXFrameworksBuildPhase section */ 73 | F18AA45A20BCE9450012D972 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | F18AA47220BCE9460012D972 /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | F18AA47D20BCE9460012D972 /* Frameworks */ = { 88 | isa = PBXFrameworksBuildPhase; 89 | buildActionMask = 2147483647; 90 | files = ( 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | /* End PBXFrameworksBuildPhase section */ 95 | 96 | /* Begin PBXGroup section */ 97 | F18AA45420BCE9450012D972 = { 98 | isa = PBXGroup; 99 | children = ( 100 | F18AA45F20BCE9450012D972 /* NumberCalculate */, 101 | F18AA47820BCE9460012D972 /* NumberCalculateTests */, 102 | F18AA48320BCE9460012D972 /* NumberCalculateUITests */, 103 | F18AA45E20BCE9450012D972 /* Products */, 104 | ); 105 | sourceTree = ""; 106 | }; 107 | F18AA45E20BCE9450012D972 /* Products */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | F18AA45D20BCE9450012D972 /* NumberCalculate.app */, 111 | F18AA47520BCE9460012D972 /* NumberCalculateTests.xctest */, 112 | F18AA48020BCE9460012D972 /* NumberCalculateUITests.xctest */, 113 | ); 114 | name = Products; 115 | sourceTree = ""; 116 | }; 117 | F18AA45F20BCE9450012D972 /* NumberCalculate */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | F18AA46020BCE9450012D972 /* AppDelegate.h */, 121 | F18AA46120BCE9450012D972 /* AppDelegate.m */, 122 | F18AA46320BCE9450012D972 /* ViewController.h */, 123 | F18AA46420BCE9450012D972 /* ViewController.m */, 124 | F152AA6820BFCC4500EE09EC /* TableViewCell.h */, 125 | F152AA6920BFCC4500EE09EC /* TableViewCell.m */, 126 | F152AA6A20BFCC4500EE09EC /* TableViewCell.xib */, 127 | F18AA49220BCE9B40012D972 /* NumberCalculate */, 128 | F18AA46620BCE9450012D972 /* Main.storyboard */, 129 | F18AA46920BCE9460012D972 /* Assets.xcassets */, 130 | F18AA46B20BCE9460012D972 /* LaunchScreen.storyboard */, 131 | F18AA46E20BCE9460012D972 /* Info.plist */, 132 | F18AA46F20BCE9460012D972 /* main.m */, 133 | ); 134 | path = NumberCalculate; 135 | sourceTree = ""; 136 | }; 137 | F18AA47820BCE9460012D972 /* NumberCalculateTests */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | F18AA47920BCE9460012D972 /* NumberCalculateTests.m */, 141 | F18AA47B20BCE9460012D972 /* Info.plist */, 142 | ); 143 | path = NumberCalculateTests; 144 | sourceTree = ""; 145 | }; 146 | F18AA48320BCE9460012D972 /* NumberCalculateUITests */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | F18AA48420BCE9460012D972 /* NumberCalculateUITests.m */, 150 | F18AA48620BCE9460012D972 /* Info.plist */, 151 | ); 152 | path = NumberCalculateUITests; 153 | sourceTree = ""; 154 | }; 155 | F18AA49220BCE9B40012D972 /* NumberCalculate */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | F18AA49620BD4AA90012D972 /* resource */, 159 | F18AA49320BCEAC50012D972 /* NumberCalculate.h */, 160 | F18AA49420BCEAC50012D972 /* NumberCalculate.m */, 161 | ); 162 | path = NumberCalculate; 163 | sourceTree = ""; 164 | }; 165 | F18AA49620BD4AA90012D972 /* resource */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | F18AA49720BD4AB40012D972 /* btn_num_add@2x.png */, 169 | F18AA49820BD4AB40012D972 /* btn_num_add@3x.png */, 170 | F18AA49C20BD4ABD0012D972 /* btn_num_minus@2x.png */, 171 | F18AA49B20BD4ABD0012D972 /* btn_num_minus@3x.png */, 172 | ); 173 | path = resource; 174 | sourceTree = ""; 175 | }; 176 | /* End PBXGroup section */ 177 | 178 | /* Begin PBXNativeTarget section */ 179 | F18AA45C20BCE9450012D972 /* NumberCalculate */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = F18AA48920BCE9460012D972 /* Build configuration list for PBXNativeTarget "NumberCalculate" */; 182 | buildPhases = ( 183 | F18AA45920BCE9450012D972 /* Sources */, 184 | F18AA45A20BCE9450012D972 /* Frameworks */, 185 | F18AA45B20BCE9450012D972 /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | ); 191 | name = NumberCalculate; 192 | productName = NumberCalculate; 193 | productReference = F18AA45D20BCE9450012D972 /* NumberCalculate.app */; 194 | productType = "com.apple.product-type.application"; 195 | }; 196 | F18AA47420BCE9460012D972 /* NumberCalculateTests */ = { 197 | isa = PBXNativeTarget; 198 | buildConfigurationList = F18AA48C20BCE9460012D972 /* Build configuration list for PBXNativeTarget "NumberCalculateTests" */; 199 | buildPhases = ( 200 | F18AA47120BCE9460012D972 /* Sources */, 201 | F18AA47220BCE9460012D972 /* Frameworks */, 202 | F18AA47320BCE9460012D972 /* Resources */, 203 | ); 204 | buildRules = ( 205 | ); 206 | dependencies = ( 207 | F18AA47720BCE9460012D972 /* PBXTargetDependency */, 208 | ); 209 | name = NumberCalculateTests; 210 | productName = NumberCalculateTests; 211 | productReference = F18AA47520BCE9460012D972 /* NumberCalculateTests.xctest */; 212 | productType = "com.apple.product-type.bundle.unit-test"; 213 | }; 214 | F18AA47F20BCE9460012D972 /* NumberCalculateUITests */ = { 215 | isa = PBXNativeTarget; 216 | buildConfigurationList = F18AA48F20BCE9460012D972 /* Build configuration list for PBXNativeTarget "NumberCalculateUITests" */; 217 | buildPhases = ( 218 | F18AA47C20BCE9460012D972 /* Sources */, 219 | F18AA47D20BCE9460012D972 /* Frameworks */, 220 | F18AA47E20BCE9460012D972 /* Resources */, 221 | ); 222 | buildRules = ( 223 | ); 224 | dependencies = ( 225 | F18AA48220BCE9460012D972 /* PBXTargetDependency */, 226 | ); 227 | name = NumberCalculateUITests; 228 | productName = NumberCalculateUITests; 229 | productReference = F18AA48020BCE9460012D972 /* NumberCalculateUITests.xctest */; 230 | productType = "com.apple.product-type.bundle.ui-testing"; 231 | }; 232 | /* End PBXNativeTarget section */ 233 | 234 | /* Begin PBXProject section */ 235 | F18AA45520BCE9450012D972 /* Project object */ = { 236 | isa = PBXProject; 237 | attributes = { 238 | LastUpgradeCheck = 0930; 239 | ORGANIZATIONNAME = singularity; 240 | TargetAttributes = { 241 | F18AA45C20BCE9450012D972 = { 242 | CreatedOnToolsVersion = 9.3.1; 243 | }; 244 | F18AA47420BCE9460012D972 = { 245 | CreatedOnToolsVersion = 9.3.1; 246 | TestTargetID = F18AA45C20BCE9450012D972; 247 | }; 248 | F18AA47F20BCE9460012D972 = { 249 | CreatedOnToolsVersion = 9.3.1; 250 | TestTargetID = F18AA45C20BCE9450012D972; 251 | }; 252 | }; 253 | }; 254 | buildConfigurationList = F18AA45820BCE9450012D972 /* Build configuration list for PBXProject "NumberCalculate" */; 255 | compatibilityVersion = "Xcode 9.3"; 256 | developmentRegion = en; 257 | hasScannedForEncodings = 0; 258 | knownRegions = ( 259 | en, 260 | Base, 261 | ); 262 | mainGroup = F18AA45420BCE9450012D972; 263 | productRefGroup = F18AA45E20BCE9450012D972 /* Products */; 264 | projectDirPath = ""; 265 | projectRoot = ""; 266 | targets = ( 267 | F18AA45C20BCE9450012D972 /* NumberCalculate */, 268 | F18AA47420BCE9460012D972 /* NumberCalculateTests */, 269 | F18AA47F20BCE9460012D972 /* NumberCalculateUITests */, 270 | ); 271 | }; 272 | /* End PBXProject section */ 273 | 274 | /* Begin PBXResourcesBuildPhase section */ 275 | F18AA45B20BCE9450012D972 /* Resources */ = { 276 | isa = PBXResourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | F18AA49E20BD4ABD0012D972 /* btn_num_minus@2x.png in Resources */, 280 | F18AA46D20BCE9460012D972 /* LaunchScreen.storyboard in Resources */, 281 | F18AA46A20BCE9460012D972 /* Assets.xcassets in Resources */, 282 | F18AA49D20BD4ABD0012D972 /* btn_num_minus@3x.png in Resources */, 283 | F18AA49A20BD4AB40012D972 /* btn_num_add@3x.png in Resources */, 284 | F152AA6C20BFCC4500EE09EC /* TableViewCell.xib in Resources */, 285 | F18AA49920BD4AB40012D972 /* btn_num_add@2x.png in Resources */, 286 | F18AA46820BCE9450012D972 /* Main.storyboard in Resources */, 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | F18AA47320BCE9460012D972 /* Resources */ = { 291 | isa = PBXResourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | F18AA47E20BCE9460012D972 /* Resources */ = { 298 | isa = PBXResourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | }; 304 | /* End PBXResourcesBuildPhase section */ 305 | 306 | /* Begin PBXSourcesBuildPhase section */ 307 | F18AA45920BCE9450012D972 /* Sources */ = { 308 | isa = PBXSourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | F18AA46520BCE9450012D972 /* ViewController.m in Sources */, 312 | F18AA47020BCE9460012D972 /* main.m in Sources */, 313 | F18AA46220BCE9450012D972 /* AppDelegate.m in Sources */, 314 | F152AA6B20BFCC4500EE09EC /* TableViewCell.m in Sources */, 315 | F18AA49520BCEAC50012D972 /* NumberCalculate.m in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | F18AA47120BCE9460012D972 /* Sources */ = { 320 | isa = PBXSourcesBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | F18AA47A20BCE9460012D972 /* NumberCalculateTests.m in Sources */, 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | F18AA47C20BCE9460012D972 /* Sources */ = { 328 | isa = PBXSourcesBuildPhase; 329 | buildActionMask = 2147483647; 330 | files = ( 331 | F18AA48520BCE9460012D972 /* NumberCalculateUITests.m in Sources */, 332 | ); 333 | runOnlyForDeploymentPostprocessing = 0; 334 | }; 335 | /* End PBXSourcesBuildPhase section */ 336 | 337 | /* Begin PBXTargetDependency section */ 338 | F18AA47720BCE9460012D972 /* PBXTargetDependency */ = { 339 | isa = PBXTargetDependency; 340 | target = F18AA45C20BCE9450012D972 /* NumberCalculate */; 341 | targetProxy = F18AA47620BCE9460012D972 /* PBXContainerItemProxy */; 342 | }; 343 | F18AA48220BCE9460012D972 /* PBXTargetDependency */ = { 344 | isa = PBXTargetDependency; 345 | target = F18AA45C20BCE9450012D972 /* NumberCalculate */; 346 | targetProxy = F18AA48120BCE9460012D972 /* PBXContainerItemProxy */; 347 | }; 348 | /* End PBXTargetDependency section */ 349 | 350 | /* Begin PBXVariantGroup section */ 351 | F18AA46620BCE9450012D972 /* Main.storyboard */ = { 352 | isa = PBXVariantGroup; 353 | children = ( 354 | F18AA46720BCE9450012D972 /* Base */, 355 | ); 356 | name = Main.storyboard; 357 | sourceTree = ""; 358 | }; 359 | F18AA46B20BCE9460012D972 /* LaunchScreen.storyboard */ = { 360 | isa = PBXVariantGroup; 361 | children = ( 362 | F18AA46C20BCE9460012D972 /* Base */, 363 | ); 364 | name = LaunchScreen.storyboard; 365 | sourceTree = ""; 366 | }; 367 | /* End PBXVariantGroup section */ 368 | 369 | /* Begin XCBuildConfiguration section */ 370 | F18AA48720BCE9460012D972 /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ALWAYS_SEARCH_USER_PATHS = NO; 374 | CLANG_ANALYZER_NONNULL = YES; 375 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 376 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 377 | CLANG_CXX_LIBRARY = "libc++"; 378 | CLANG_ENABLE_MODULES = YES; 379 | CLANG_ENABLE_OBJC_ARC = YES; 380 | CLANG_ENABLE_OBJC_WEAK = YES; 381 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 382 | CLANG_WARN_BOOL_CONVERSION = YES; 383 | CLANG_WARN_COMMA = YES; 384 | CLANG_WARN_CONSTANT_CONVERSION = YES; 385 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 387 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 388 | CLANG_WARN_EMPTY_BODY = YES; 389 | CLANG_WARN_ENUM_CONVERSION = YES; 390 | CLANG_WARN_INFINITE_RECURSION = YES; 391 | CLANG_WARN_INT_CONVERSION = YES; 392 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 393 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 394 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 395 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 396 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 397 | CLANG_WARN_STRICT_PROTOTYPES = YES; 398 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 399 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 400 | CLANG_WARN_UNREACHABLE_CODE = YES; 401 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 402 | CODE_SIGN_IDENTITY = "iPhone Developer"; 403 | COPY_PHASE_STRIP = NO; 404 | DEBUG_INFORMATION_FORMAT = dwarf; 405 | ENABLE_STRICT_OBJC_MSGSEND = YES; 406 | ENABLE_TESTABILITY = YES; 407 | GCC_C_LANGUAGE_STANDARD = gnu11; 408 | GCC_DYNAMIC_NO_PIC = NO; 409 | GCC_NO_COMMON_BLOCKS = YES; 410 | GCC_OPTIMIZATION_LEVEL = 0; 411 | GCC_PREPROCESSOR_DEFINITIONS = ( 412 | "DEBUG=1", 413 | "$(inherited)", 414 | ); 415 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 416 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 417 | GCC_WARN_UNDECLARED_SELECTOR = YES; 418 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 419 | GCC_WARN_UNUSED_FUNCTION = YES; 420 | GCC_WARN_UNUSED_VARIABLE = YES; 421 | IPHONEOS_DEPLOYMENT_TARGET = 11.3; 422 | MTL_ENABLE_DEBUG_INFO = YES; 423 | ONLY_ACTIVE_ARCH = YES; 424 | SDKROOT = iphoneos; 425 | }; 426 | name = Debug; 427 | }; 428 | F18AA48820BCE9460012D972 /* Release */ = { 429 | isa = XCBuildConfiguration; 430 | buildSettings = { 431 | ALWAYS_SEARCH_USER_PATHS = NO; 432 | CLANG_ANALYZER_NONNULL = YES; 433 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 434 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 435 | CLANG_CXX_LIBRARY = "libc++"; 436 | CLANG_ENABLE_MODULES = YES; 437 | CLANG_ENABLE_OBJC_ARC = YES; 438 | CLANG_ENABLE_OBJC_WEAK = YES; 439 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 440 | CLANG_WARN_BOOL_CONVERSION = YES; 441 | CLANG_WARN_COMMA = YES; 442 | CLANG_WARN_CONSTANT_CONVERSION = YES; 443 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 444 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 445 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 446 | CLANG_WARN_EMPTY_BODY = YES; 447 | CLANG_WARN_ENUM_CONVERSION = YES; 448 | CLANG_WARN_INFINITE_RECURSION = YES; 449 | CLANG_WARN_INT_CONVERSION = YES; 450 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 451 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 452 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 453 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 454 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 455 | CLANG_WARN_STRICT_PROTOTYPES = YES; 456 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 457 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 458 | CLANG_WARN_UNREACHABLE_CODE = YES; 459 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 460 | CODE_SIGN_IDENTITY = "iPhone Developer"; 461 | COPY_PHASE_STRIP = NO; 462 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 463 | ENABLE_NS_ASSERTIONS = NO; 464 | ENABLE_STRICT_OBJC_MSGSEND = YES; 465 | GCC_C_LANGUAGE_STANDARD = gnu11; 466 | GCC_NO_COMMON_BLOCKS = YES; 467 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 468 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 469 | GCC_WARN_UNDECLARED_SELECTOR = YES; 470 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 471 | GCC_WARN_UNUSED_FUNCTION = YES; 472 | GCC_WARN_UNUSED_VARIABLE = YES; 473 | IPHONEOS_DEPLOYMENT_TARGET = 11.3; 474 | MTL_ENABLE_DEBUG_INFO = NO; 475 | SDKROOT = iphoneos; 476 | VALIDATE_PRODUCT = YES; 477 | }; 478 | name = Release; 479 | }; 480 | F18AA48A20BCE9460012D972 /* Debug */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 484 | CODE_SIGN_STYLE = Automatic; 485 | DEVELOPMENT_TEAM = 92G97Q35ZF; 486 | INFOPLIST_FILE = NumberCalculate/Info.plist; 487 | LD_RUNPATH_SEARCH_PATHS = ( 488 | "$(inherited)", 489 | "@executable_path/Frameworks", 490 | ); 491 | PRODUCT_BUNDLE_IDENTIFIER = singularity.NumberCalculate; 492 | PRODUCT_NAME = "$(TARGET_NAME)"; 493 | TARGETED_DEVICE_FAMILY = "1,2"; 494 | }; 495 | name = Debug; 496 | }; 497 | F18AA48B20BCE9460012D972 /* Release */ = { 498 | isa = XCBuildConfiguration; 499 | buildSettings = { 500 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 501 | CODE_SIGN_STYLE = Automatic; 502 | DEVELOPMENT_TEAM = 92G97Q35ZF; 503 | INFOPLIST_FILE = NumberCalculate/Info.plist; 504 | LD_RUNPATH_SEARCH_PATHS = ( 505 | "$(inherited)", 506 | "@executable_path/Frameworks", 507 | ); 508 | PRODUCT_BUNDLE_IDENTIFIER = singularity.NumberCalculate; 509 | PRODUCT_NAME = "$(TARGET_NAME)"; 510 | TARGETED_DEVICE_FAMILY = "1,2"; 511 | }; 512 | name = Release; 513 | }; 514 | F18AA48D20BCE9460012D972 /* Debug */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | BUNDLE_LOADER = "$(TEST_HOST)"; 518 | CODE_SIGN_STYLE = Automatic; 519 | DEVELOPMENT_TEAM = 92G97Q35ZF; 520 | INFOPLIST_FILE = NumberCalculateTests/Info.plist; 521 | LD_RUNPATH_SEARCH_PATHS = ( 522 | "$(inherited)", 523 | "@executable_path/Frameworks", 524 | "@loader_path/Frameworks", 525 | ); 526 | PRODUCT_BUNDLE_IDENTIFIER = singularity.NumberCalculateTests; 527 | PRODUCT_NAME = "$(TARGET_NAME)"; 528 | TARGETED_DEVICE_FAMILY = "1,2"; 529 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NumberCalculate.app/NumberCalculate"; 530 | }; 531 | name = Debug; 532 | }; 533 | F18AA48E20BCE9460012D972 /* Release */ = { 534 | isa = XCBuildConfiguration; 535 | buildSettings = { 536 | BUNDLE_LOADER = "$(TEST_HOST)"; 537 | CODE_SIGN_STYLE = Automatic; 538 | DEVELOPMENT_TEAM = 92G97Q35ZF; 539 | INFOPLIST_FILE = NumberCalculateTests/Info.plist; 540 | LD_RUNPATH_SEARCH_PATHS = ( 541 | "$(inherited)", 542 | "@executable_path/Frameworks", 543 | "@loader_path/Frameworks", 544 | ); 545 | PRODUCT_BUNDLE_IDENTIFIER = singularity.NumberCalculateTests; 546 | PRODUCT_NAME = "$(TARGET_NAME)"; 547 | TARGETED_DEVICE_FAMILY = "1,2"; 548 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NumberCalculate.app/NumberCalculate"; 549 | }; 550 | name = Release; 551 | }; 552 | F18AA49020BCE9460012D972 /* Debug */ = { 553 | isa = XCBuildConfiguration; 554 | buildSettings = { 555 | CODE_SIGN_STYLE = Automatic; 556 | DEVELOPMENT_TEAM = 92G97Q35ZF; 557 | INFOPLIST_FILE = NumberCalculateUITests/Info.plist; 558 | LD_RUNPATH_SEARCH_PATHS = ( 559 | "$(inherited)", 560 | "@executable_path/Frameworks", 561 | "@loader_path/Frameworks", 562 | ); 563 | PRODUCT_BUNDLE_IDENTIFIER = singularity.NumberCalculateUITests; 564 | PRODUCT_NAME = "$(TARGET_NAME)"; 565 | TARGETED_DEVICE_FAMILY = "1,2"; 566 | TEST_TARGET_NAME = NumberCalculate; 567 | }; 568 | name = Debug; 569 | }; 570 | F18AA49120BCE9460012D972 /* Release */ = { 571 | isa = XCBuildConfiguration; 572 | buildSettings = { 573 | CODE_SIGN_STYLE = Automatic; 574 | DEVELOPMENT_TEAM = 92G97Q35ZF; 575 | INFOPLIST_FILE = NumberCalculateUITests/Info.plist; 576 | LD_RUNPATH_SEARCH_PATHS = ( 577 | "$(inherited)", 578 | "@executable_path/Frameworks", 579 | "@loader_path/Frameworks", 580 | ); 581 | PRODUCT_BUNDLE_IDENTIFIER = singularity.NumberCalculateUITests; 582 | PRODUCT_NAME = "$(TARGET_NAME)"; 583 | TARGETED_DEVICE_FAMILY = "1,2"; 584 | TEST_TARGET_NAME = NumberCalculate; 585 | }; 586 | name = Release; 587 | }; 588 | /* End XCBuildConfiguration section */ 589 | 590 | /* Begin XCConfigurationList section */ 591 | F18AA45820BCE9450012D972 /* Build configuration list for PBXProject "NumberCalculate" */ = { 592 | isa = XCConfigurationList; 593 | buildConfigurations = ( 594 | F18AA48720BCE9460012D972 /* Debug */, 595 | F18AA48820BCE9460012D972 /* Release */, 596 | ); 597 | defaultConfigurationIsVisible = 0; 598 | defaultConfigurationName = Release; 599 | }; 600 | F18AA48920BCE9460012D972 /* Build configuration list for PBXNativeTarget "NumberCalculate" */ = { 601 | isa = XCConfigurationList; 602 | buildConfigurations = ( 603 | F18AA48A20BCE9460012D972 /* Debug */, 604 | F18AA48B20BCE9460012D972 /* Release */, 605 | ); 606 | defaultConfigurationIsVisible = 0; 607 | defaultConfigurationName = Release; 608 | }; 609 | F18AA48C20BCE9460012D972 /* Build configuration list for PBXNativeTarget "NumberCalculateTests" */ = { 610 | isa = XCConfigurationList; 611 | buildConfigurations = ( 612 | F18AA48D20BCE9460012D972 /* Debug */, 613 | F18AA48E20BCE9460012D972 /* Release */, 614 | ); 615 | defaultConfigurationIsVisible = 0; 616 | defaultConfigurationName = Release; 617 | }; 618 | F18AA48F20BCE9460012D972 /* Build configuration list for PBXNativeTarget "NumberCalculateUITests" */ = { 619 | isa = XCConfigurationList; 620 | buildConfigurations = ( 621 | F18AA49020BCE9460012D972 /* Debug */, 622 | F18AA49120BCE9460012D972 /* Release */, 623 | ); 624 | defaultConfigurationIsVisible = 0; 625 | defaultConfigurationName = Release; 626 | }; 627 | /* End XCConfigurationList section */ 628 | }; 629 | rootObject = F18AA45520BCE9450012D972 /* Project object */; 630 | } 631 | -------------------------------------------------------------------------------- /NumberCalculate.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NumberCalculate.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /NumberCalculate.xcodeproj/xcuserdata/singularity.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /NumberCalculate.xcodeproj/xcuserdata/singularity.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | NumberCalculate.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | NumberCalculate.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /NumberCalculate/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // NumberCalculate 4 | // 5 | // Created by 李雪阳 on 2018/5/29. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /NumberCalculate/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // NumberCalculate 4 | // 5 | // Created by 李雪阳 on 2018/5/29. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /NumberCalculate/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /NumberCalculate/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /NumberCalculate/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /NumberCalculate/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 | -------------------------------------------------------------------------------- /NumberCalculate/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /NumberCalculate/NumberCalculate/NumberCalculate.h: -------------------------------------------------------------------------------- 1 | // 2 | // NumberCalculate.h 3 | // NumberCalculate 4 | // 5 | // Created by 李雪阳 on 2018/5/29. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol NumberCalculateDelegate 12 | 13 | - (void)resultNumber:(NSInteger)number; 14 | 15 | @end 16 | 17 | @interface NumberCalculate : UIView 18 | 19 | /** 结果回传 */ 20 | @property (nonatomic, copy) void (^resultNumber)(NSInteger number); 21 | @property (nonatomic, weak) iddelegate; 22 | 23 | 24 | /** 显示数值/初始值 默认0 */ 25 | @property (nonatomic, assign) NSInteger showNum; 26 | 27 | /** 数值增减基数(倍数增减) 默认1的倍数增减 */ 28 | @property (nonatomic, assign) NSInteger multipleNum; 29 | 30 | /** 最小值 默认且最小为0*/ 31 | @property (nonatomic, assign) NSInteger minNum; 32 | 33 | /** 最大值 默认99999 */ 34 | @property (nonatomic, assign) NSInteger maxNum; 35 | 36 | /** 重置显示数值并回传结果 */ 37 | @property (nonatomic, assign) NSInteger resetShowNum;//场景:商品sku切换时 A商品最高sku高于B商品 选择A商品并将数量设置为A商品的最高sku 切换到B商品时需重置当前所选数量至B商品的最高sku并回传结果 38 | 39 | /** 返回当前显示的数值 */ 40 | - (NSInteger)currentNumber; 41 | 42 | 43 | 44 | /** 数字框是否可以手动输入 默认可以 */ 45 | @property (nonatomic, assign) BOOL canText; 46 | 47 | /** 是否开启晃动 默认开启 */ 48 | @property (nonatomic, assign) BOOL isShake; 49 | 50 | 51 | 52 | /** 是否隐藏边框线 默认显示 */ 53 | @property (nonatomic, assign) BOOL hidBorder; 54 | 55 | /** 视图圆角弧度 */ 56 | @property (nonatomic, assign) CGFloat numCornerRadius; 57 | 58 | /** 边框线颜色 */ 59 | @property (nonatomic, strong) UIColor *numBorderColor; 60 | 61 | /** 加减按钮颜色 */ 62 | @property (nonatomic, strong) UIColor *buttonColor; 63 | 64 | /** 数值文字颜色 */ 65 | @property (nonatomic, strong) UIColor *numTextColor; 66 | 67 | /** 数值文字字体 */ 68 | @property (nonatomic, strong) UIFont *numTextFont; 69 | 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /NumberCalculate/NumberCalculate/NumberCalculate.m: -------------------------------------------------------------------------------- 1 | // 2 | // NumberCalculate.m 3 | // NumberCalculate 4 | // 5 | // Created by 李雪阳 on 2018/5/29. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import "NumberCalculate.h" 10 | 11 | @interface NumberCalculate() 12 | /** 加 */ 13 | @property (nonatomic, strong) UIButton *addBtn; 14 | /** 减 */ 15 | @property (nonatomic, strong) UIButton *reduceBtn; 16 | /** 数值框 */ 17 | @property (nonatomic, strong) UITextField *numberText; 18 | /** 记录数值 */ 19 | @property (nonatomic, copy) NSString *recordNum; 20 | 21 | /** 减号分割线 */ 22 | @property (nonatomic, strong) UILabel *segmentReduce; 23 | /** 加号分割线 */ 24 | @property (nonatomic, strong) UILabel *segmentAdd; 25 | 26 | @end 27 | 28 | #define numborderWidth 1 29 | #define defaultMax 99999 30 | 31 | @implementation NumberCalculate 32 | 33 | - (instancetype)initWithFrame:(CGRect)frame{ 34 | self=[super initWithFrame:frame]; 35 | if (self){ 36 | [self setView]; 37 | } 38 | return self; 39 | } 40 | 41 | - (instancetype)init{ 42 | if (self = [super init]){ 43 | [self setView]; 44 | } 45 | return self; 46 | } 47 | 48 | - (void)awakeFromNib{ 49 | [super awakeFromNib]; 50 | [self setView]; 51 | } 52 | 53 | - (void)setView{ 54 | [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; 55 | 56 | _isShake=YES; 57 | _multipleNum=1; 58 | _minNum=0; 59 | _maxNum=defaultMax; 60 | 61 | CGFloat viewWidth=self.frame.size.width; 62 | CGFloat btnWidth=self.frame.size.height; 63 | _reduceBtn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, btnWidth, btnWidth)]; 64 | [_reduceBtn setImage:[UIImage imageNamed:@"btn_num_minus"] forState:UIControlStateNormal]; 65 | [_reduceBtn addTarget:self action:@selector(reduceNumberClick) forControlEvents:UIControlEventTouchUpInside]; 66 | [self addSubview:_reduceBtn]; 67 | 68 | _numberText=[[UITextField alloc]initWithFrame:CGRectMake(btnWidth-1, 0, viewWidth-btnWidth*2, btnWidth)]; 69 | _numberText.text=[NSString stringWithFormat:@"%ld",_showNum]; 70 | _numberText.userInteractionEnabled=YES; 71 | _numberText.textColor=[UIColor darkGrayColor]; 72 | _numberText.font=[UIFont systemFontOfSize:14]; 73 | _numberText.keyboardType = UIKeyboardTypeNumberPad; 74 | _numberText.textAlignment = NSTextAlignmentCenter; 75 | _numberText.delegate=self; 76 | [_numberText addTarget:self action:@selector(textNumberChange:) forControlEvents:UIControlEventEditingChanged]; 77 | [self addSubview:_numberText]; 78 | 79 | _addBtn=[[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_numberText.frame)-1, 0, btnWidth, btnWidth)]; 80 | [_addBtn setImage:[UIImage imageNamed:@"btn_num_add"] forState:UIControlStateNormal]; 81 | [_addBtn addTarget:self action:@selector(addNumberClick) forControlEvents:UIControlEventTouchUpInside]; 82 | [self addSubview:_addBtn]; 83 | 84 | _segmentReduce=[[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_reduceBtn.frame), (btnWidth/2)*1/3, 0.5, btnWidth-((btnWidth/2)*2/3))]; 85 | [self addSubview:_segmentReduce]; 86 | 87 | _segmentAdd=[[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_numberText.frame), (btnWidth/2)*1/3, 0.5, btnWidth-((btnWidth/2)*2/3))]; 88 | [self addSubview:_segmentAdd]; 89 | 90 | 91 | _segmentReduce.backgroundColor=[UIColor lightGrayColor]; 92 | _segmentAdd.backgroundColor=[UIColor lightGrayColor]; 93 | self.layer.borderWidth=numborderWidth; 94 | self.layer.borderColor=[UIColor lightGrayColor].CGColor; 95 | 96 | } 97 | 98 | /** 减 */ 99 | - (void)reduceNumberClick{ 100 | [_numberText resignFirstResponder]; 101 | 102 | if ([_numberText.text integerValue]<= _minNum){ 103 | [self shakeAnimation]; 104 | return; 105 | } 106 | 107 | _numberText.text=[NSString stringWithFormat:@"%ld",(long)[_numberText.text integerValue]-_multipleNum]; 108 | 109 | [self callBackResultNumber:_numberText.text.integerValue]; 110 | } 111 | 112 | /** 加 */ 113 | - (void)addNumberClick{ 114 | [_numberText resignFirstResponder]; 115 | 116 | if (_numberText.text.integerValue < _maxNum) { 117 | _numberText.text=[NSString stringWithFormat:@"%ld",(long)[_numberText.text integerValue]+_multipleNum]; 118 | }else{ 119 | [self shakeAnimation]; 120 | } 121 | 122 | [self callBackResultNumber:_numberText.text.integerValue]; 123 | } 124 | 125 | /** 数值变化 */ 126 | - (void)textNumberChange:(UITextField *)textField{ 127 | if (textField.text.integerValue < _minNum) { 128 | [self alertMessage:@"您输入的数量小于最小值,请重新输入"]; 129 | textField.text=@""; 130 | } 131 | 132 | if (textField.text.integerValue > _maxNum) { 133 | [self alertMessage:@"您输入的数量大于最大值,请重新输入"]; 134 | textField.text = @""; 135 | return; 136 | } 137 | } 138 | 139 | -(void)textFieldDidBeginEditing:(UITextField *)textField{ 140 | _recordNum = textField.text; 141 | textField.text = @""; 142 | } 143 | 144 | -(void)textFieldDidEndEditing:(UITextField *)textField{ 145 | 146 | if (textField.text.length == 0) { 147 | textField.text = _recordNum; 148 | } 149 | 150 | if (textField.text.integerValue/_multipleNum == 0) {//输入小于基本倍数值 更改为倍数数值/若想在minNum为0的情况下输入小于倍数值的时候 更改为0 增加为0时的else内判断即可(如 倍数值为3,键入1 需求更改为0数值的情况下) 151 | textField.text=[NSString stringWithFormat:@"%ld",_multipleNum]; 152 | }else{ 153 | textField.text=[NSString stringWithFormat:@"%ld",(long)(textField.text.integerValue/_multipleNum)*_multipleNum]; 154 | } 155 | 156 | [self callBackResultNumber:textField.text.integerValue]; 157 | } 158 | 159 | - (void)callBackResultNumber:(NSInteger)number{ 160 | if (self.resultNumber) { 161 | self.resultNumber(number); 162 | } 163 | 164 | if ([self.delegate respondsToSelector:@selector(resultNumber:)]) { 165 | [self.delegate resultNumber:number]; 166 | } 167 | } 168 | 169 | 170 | /** 限制输入数字 */ 171 | - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { 172 | return [self validateNumber:string]; 173 | } 174 | 175 | - (BOOL)validateNumber:(NSString*)number { 176 | BOOL res = YES; 177 | NSCharacterSet* tmpSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"]; 178 | int i = 0; 179 | while (i < number.length) { 180 | NSString * string = [number substringWithRange:NSMakeRange(i, 1)]; 181 | NSRange range = [string rangeOfCharacterFromSet:tmpSet]; 182 | if (range.length == 0) { 183 | res = NO; 184 | break; 185 | } 186 | i++; 187 | } 188 | return res; 189 | } 190 | 191 | 192 | /** 抖动动画 */ 193 | - (void)shakeAnimation 194 | { 195 | if (_isShake) { 196 | CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position.x"]; 197 | //获取当前View的position坐标 198 | CGFloat positionX = self.layer.position.x; 199 | //设置抖动的范围 200 | animation.values = @[@(positionX-4),@(positionX),@(positionX+4)]; 201 | //动画重复的次数 202 | animation.repeatCount = 3; 203 | //动画时间 204 | animation.duration = 0.07; 205 | //设置自动反转 206 | animation.autoreverses = YES; 207 | [self.layer addAnimation:animation forKey:nil]; 208 | } 209 | } 210 | 211 | 212 | /** 提示 */ 213 | - (void)alertMessage:(NSString *)message 214 | { 215 | UIAlertView *alertView=[[UIAlertView alloc]initWithTitle:@"提示" message:message delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; 216 | [alertView show]; 217 | } 218 | 219 | /** setter getter */ 220 | - (void)setShowNum:(NSInteger)showNum{ 221 | _showNum=showNum; 222 | _numberText.text=[NSString stringWithFormat:@"%ld",showNum]; 223 | } 224 | 225 | - (void)setResetShowNum:(NSInteger)resetShowNum{ 226 | _resetShowNum=resetShowNum; 227 | _numberText.text=[NSString stringWithFormat:@"%ld",resetShowNum]; 228 | [self callBackResultNumber:resetShowNum]; 229 | } 230 | 231 | - (void)setMultipleNum:(NSInteger)multipleNum{ 232 | _multipleNum=multipleNum; 233 | } 234 | 235 | - (void)setMinNum:(NSInteger)minNum{ 236 | if (minNum<0) { 237 | minNum=0; 238 | } 239 | _minNum=minNum; 240 | } 241 | 242 | - (void)setMaxNum:(NSInteger)maxNum{ 243 | _maxNum=maxNum; 244 | } 245 | 246 | - (NSInteger)currentNumber{ 247 | return _numberText.text.integerValue; 248 | } 249 | 250 | 251 | 252 | - (void)setCanText:(BOOL)canText{ 253 | _canText=canText; 254 | _numberText.userInteractionEnabled=_canText; 255 | } 256 | 257 | - (void)setIsShake:(BOOL)isShake{ 258 | _isShake=isShake; 259 | } 260 | 261 | 262 | 263 | - (void)setHidBorder:(BOOL)hidBorder{ 264 | _hidBorder=hidBorder; 265 | 266 | if (hidBorder) { 267 | _segmentReduce.backgroundColor=[UIColor clearColor]; 268 | _segmentAdd.backgroundColor=[UIColor clearColor]; 269 | self.layer.borderColor=[UIColor clearColor].CGColor; 270 | } 271 | } 272 | 273 | - (void)setNumCornerRadius:(CGFloat)numCornerRadius{ 274 | _numCornerRadius=numCornerRadius; 275 | self.layer.masksToBounds=YES; 276 | self.layer.cornerRadius=_numCornerRadius; 277 | } 278 | 279 | - (void)setNumBorderColor:(UIColor *)numBorderColor{ 280 | _numBorderColor=numBorderColor; 281 | 282 | _segmentReduce.backgroundColor=_numBorderColor; 283 | _segmentAdd.backgroundColor=_numBorderColor; 284 | self.layer.borderColor=_numBorderColor.CGColor; 285 | } 286 | 287 | - (void)setButtonColor:(UIColor *)buttonColor{ 288 | _buttonColor=buttonColor; 289 | 290 | _reduceBtn.backgroundColor=_buttonColor; 291 | _addBtn.backgroundColor=_buttonColor; 292 | } 293 | 294 | - (void)setNumTextColor:(UIColor *)numTextColor{ 295 | _numTextColor=numTextColor; 296 | _numberText.textColor=numTextColor; 297 | } 298 | 299 | - (void)setNumTextFont:(UIFont *)numTextFont{ 300 | _numTextFont=numTextFont; 301 | _numberText.font=numTextFont; 302 | } 303 | 304 | 305 | @end 306 | -------------------------------------------------------------------------------- /NumberCalculate/NumberCalculate/resource/btn_num_add@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XueYangLee/NumberCalculate/6b93ec1026639e42b173e59f24a8dec82a552b3a/NumberCalculate/NumberCalculate/resource/btn_num_add@2x.png -------------------------------------------------------------------------------- /NumberCalculate/NumberCalculate/resource/btn_num_add@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XueYangLee/NumberCalculate/6b93ec1026639e42b173e59f24a8dec82a552b3a/NumberCalculate/NumberCalculate/resource/btn_num_add@3x.png -------------------------------------------------------------------------------- /NumberCalculate/NumberCalculate/resource/btn_num_minus@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XueYangLee/NumberCalculate/6b93ec1026639e42b173e59f24a8dec82a552b3a/NumberCalculate/NumberCalculate/resource/btn_num_minus@2x.png -------------------------------------------------------------------------------- /NumberCalculate/NumberCalculate/resource/btn_num_minus@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XueYangLee/NumberCalculate/6b93ec1026639e42b173e59f24a8dec82a552b3a/NumberCalculate/NumberCalculate/resource/btn_num_minus@3x.png -------------------------------------------------------------------------------- /NumberCalculate/TableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewCell.h 3 | // NumberCalculate 4 | // 5 | // Created by 李雪阳 on 2018/5/31. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "NumberCalculate.h" 11 | 12 | @interface TableViewCell : UITableViewCell 13 | 14 | @property (weak, nonatomic) IBOutlet NumberCalculate *numberCalculate; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /NumberCalculate/TableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewCell.m 3 | // NumberCalculate 4 | // 5 | // Created by 李雪阳 on 2018/5/31. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import "TableViewCell.h" 10 | 11 | @implementation TableViewCell 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | // Initialization code 16 | _numberCalculate.delegate=self; 17 | } 18 | 19 | - (void)resultNumber:(NSInteger)number{ 20 | NSLog(@"%ld>>>resultDelegate>>",number); 21 | } 22 | 23 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /NumberCalculate/TableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /NumberCalculate/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // NumberCalculate 4 | // 5 | // Created by 李雪阳 on 2018/5/29. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /NumberCalculate/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // NumberCalculate 4 | // 5 | // Created by 李雪阳 on 2018/5/29. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "NumberCalculate.h" 11 | #import "TableViewCell.h" 12 | 13 | @interface ViewController () 14 | 15 | @property (nonatomic, strong) NumberCalculate *number; 16 | 17 | @end 18 | 19 | #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width) 20 | #define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height) 21 | 22 | @implementation ViewController 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | // Do any additional setup after loading the view, typically from a nib. 27 | 28 | UILabel *remind=[[UILabel alloc]initWithFrame:CGRectMake(50, 70, 150, 20)]; 29 | remind.textColor=[UIColor blackColor]; 30 | remind.text=@"倍数加减(2倍)"; 31 | [self.view addSubview:remind]; 32 | 33 | _number=[[NumberCalculate alloc]initWithFrame:CGRectMake(50, 100, 150, 50)]; 34 | _number.numCornerRadius=15; 35 | _number.showNum=2; 36 | _number.multipleNum=2;//数值增减基数(倍数增减) 默认1的倍数增减 37 | _number.minNum=2; 38 | _number.maxNum=10;//最大值 39 | [self.view addSubview:_number]; 40 | _number.resultNumber = ^(NSInteger number) { 41 | NSLog(@"%ld>>>resultBlock>>",number); 42 | }; 43 | 44 | 45 | UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(50, CGRectGetMaxY(_number.frame)+30, 30, 30)]; 46 | btn.backgroundColor=[UIColor blueColor]; 47 | [btn addTarget:self action:@selector(changeNumber) forControlEvents:UIControlEventTouchUpInside]; 48 | [self.view addSubview:btn]; 49 | 50 | /**************************************************************/ 51 | UILabel *xib=[[UILabel alloc]initWithFrame:CGRectMake(50, SCREEN_HEIGHT/2-30, 200, 20)]; 52 | xib.textColor=[UIColor blackColor]; 53 | xib.text=@"xib搭建的cell上使用"; 54 | [self.view addSubview:xib]; 55 | 56 | 57 | UITableView *table=[[UITableView alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT/2, SCREEN_WIDTH, SCREEN_HEIGHT/2) style:UITableViewStylePlain]; 58 | table.rowHeight=100; 59 | table.delegate=self; 60 | table.dataSource=self; 61 | [self.view addSubview:table]; 62 | 63 | } 64 | 65 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 66 | return 5; 67 | } 68 | 69 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 70 | TableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"cid"]; 71 | if (cell==nil) { 72 | cell=[[[NSBundle mainBundle]loadNibNamed:@"TableViewCell" owner:self options:nil]lastObject]; 73 | } 74 | return cell; 75 | } 76 | 77 | 78 | - (void)changeNumber{ 79 | _number.showNum=6; 80 | NSLog(@"%ld>>当前显示",_number.currentNumber); 81 | } 82 | 83 | 84 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 85 | [self.view endEditing:YES]; 86 | } 87 | 88 | 89 | - (void)didReceiveMemoryWarning { 90 | [super didReceiveMemoryWarning]; 91 | // Dispose of any resources that can be recreated. 92 | } 93 | 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /NumberCalculate/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // NumberCalculate 4 | // 5 | // Created by 李雪阳 on 2018/5/29. 6 | // Copyright © 2018年 singularity. 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 | -------------------------------------------------------------------------------- /NumberCalculateTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NumberCalculateTests/NumberCalculateTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NumberCalculateTests.m 3 | // NumberCalculateTests 4 | // 5 | // Created by 李雪阳 on 2018/5/29. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NumberCalculateTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NumberCalculateTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /NumberCalculateUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NumberCalculateUITests/NumberCalculateUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NumberCalculateUITests.m 3 | // NumberCalculateUITests 4 | // 5 | // Created by 李雪阳 on 2018/5/29. 6 | // Copyright © 2018年 singularity. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NumberCalculateUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NumberCalculateUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NumberCalculate 2 | 3 | 用于购物车或者商品货物添加以更改数量使用 4 | 5 | 参数信息 6 | ``` 7 | /** 显示数值/初始值 默认0 */ 8 | @property (nonatomic, assign) NSInteger showNum; 9 | 10 | /** 数值增减基数(倍数增减) 默认1的倍数增减 */ 11 | @property (nonatomic, assign) NSInteger multipleNum; 12 | 13 | /** 最小值 默认且最小为0*/ 14 | @property (nonatomic, assign) NSInteger minNum; 15 | 16 | /** 最大值 默认99999 */ 17 | @property (nonatomic, assign) NSInteger maxNum; 18 | 19 | /** 返回当前显示的数值 */ 20 | - (NSInteger)currentNumber; 21 | 22 | 23 | 24 | /** 数字框是否可以手动输入 默认可以 */ 25 | @property (nonatomic, assign) BOOL canText; 26 | 27 | /** 是否开启晃动 默认开启 */ 28 | @property (nonatomic, assign) BOOL isShake; 29 | 30 | 31 | 32 | /** 是否隐藏边框线 默认显示 */ 33 | @property (nonatomic, assign) BOOL hidBorder; 34 | 35 | /** 视图圆角弧度 */ 36 | @property (nonatomic, assign) CGFloat numCornerRadius; 37 | 38 | /** 边框线颜色 */ 39 | @property (nonatomic, strong) UIColor *numBorderColor; 40 | 41 | /** 加减按钮颜色 */ 42 | @property (nonatomic, strong) UIColor *buttonColor; 43 | 44 | /** 数值文字颜色 */ 45 | @property (nonatomic, strong) UIColor *numTextColor; 46 | 47 | /** 数值文字字体 */ 48 | @property (nonatomic, strong) UIFont *numTextFont; 49 | ``` 50 | 51 | 回调方式block跟delegate两种方式可选 52 | ``` 53 | /** 结果回传 */ 54 | @property (nonatomic, copy) void (^resultNumber)(NSInteger number); 55 | 56 | @property (nonatomic, weak) iddelegate; 57 | - (void)resultNumber:(NSInteger)number; 58 | ``` 59 | 60 | ``` 61 | _number.resultNumber = ^(NSInteger number) { 62 | NSLog(@"%ld>>>resultBlock>>",number); 63 | }; 64 | 65 | 66 | - (void)resultNumber:(NSInteger)number{ 67 | NSLog(@"%ld>>>resultDelegate>>",number); 68 | } 69 | ``` 70 | 71 | ![参考](https://github.com/XueYangLee/NumberCalculate/blob/master/screen.gif) 72 | -------------------------------------------------------------------------------- /screen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XueYangLee/NumberCalculate/6b93ec1026639e42b173e59f24a8dec82a552b3a/screen.gif --------------------------------------------------------------------------------