├── .gitignore ├── LICENSE ├── README.md └── RYNumberKeyboardDemo ├── RYNumberKeyboardDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── RYNumberKeyboardDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── RYNumberKeyboardDemoTests ├── Info.plist └── RYNumberKeyboardDemoTests.m ├── RYNumberKeyboardDemoUITests ├── Info.plist └── RYNumberKeyboardDemoUITests.m └── RYNumberkeyboard ├── RYNumbeKeyboard.bundle └── image │ ├── delete@2x.png │ ├── delete@3x.png │ ├── resign@2x.png │ └── resign@3x.png ├── RYNumberKeyboard.h ├── RYNumberKeyboard.m ├── RYNumberKeyboard.xib ├── UITextField+RYNumberKeyboard.h └── UITextField+RYNumberKeyboard.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | *.DS_Store 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | *.ipa 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 52 | 53 | fastlane/report.xml 54 | fastlane/screenshots 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Resory 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RYNumberKeyboard 2 | 3 | `RYNumberKeyboard` 是一个数字相关键盘,目前有三种类型:整数键盘,浮点数键盘,身份证键盘。 4 | 5 | # 使用方法 6 | 7 | ``` 8 | #import "UITextField+RYNumberKeyboard.h" 9 | 10 | yourTextFiled.ry_inputType = RYIntInputType; //数字键盘 11 | yourTextFiled.ry_inputType = RYIDCardInputType; //身份证键盘 12 | yourTextFiled.ry_inputType = RYFloatInputType; //浮点数键盘 13 | 14 | yourTextFiled.ry_interval = 4 //每隔4个数字输入一个空格 15 | ``` 16 | 17 | # 效果 18 | 19 | ![RYNumberKeyboard](https://github.com/Resory/Images/blob/master/RYNumberKeyboard.gif) 20 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 037DA6CC1C79FEAC00D8896F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 037DA6CB1C79FEAC00D8896F /* main.m */; }; 11 | 037DA6CF1C79FEAC00D8896F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 037DA6CE1C79FEAC00D8896F /* AppDelegate.m */; }; 12 | 037DA6D21C79FEAC00D8896F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 037DA6D11C79FEAC00D8896F /* ViewController.m */; }; 13 | 037DA6D51C79FEAC00D8896F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 037DA6D31C79FEAC00D8896F /* Main.storyboard */; }; 14 | 037DA6D71C79FEAC00D8896F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 037DA6D61C79FEAC00D8896F /* Assets.xcassets */; }; 15 | 037DA6DA1C79FEAC00D8896F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 037DA6D81C79FEAC00D8896F /* LaunchScreen.storyboard */; }; 16 | 037DA6E51C79FEAC00D8896F /* RYNumberKeyboardDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 037DA6E41C79FEAC00D8896F /* RYNumberKeyboardDemoTests.m */; }; 17 | 037DA6F01C79FEAC00D8896F /* RYNumberKeyboardDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 037DA6EF1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests.m */; }; 18 | 037DA70A1C79FF2300D8896F /* RYNumbeKeyboard.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 037DA7061C79FF2300D8896F /* RYNumbeKeyboard.bundle */; }; 19 | 037DA70B1C79FF2300D8896F /* RYNumberKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 037DA7081C79FF2300D8896F /* RYNumberKeyboard.m */; }; 20 | 037DA70C1C79FF2300D8896F /* RYNumberKeyboard.xib in Resources */ = {isa = PBXBuildFile; fileRef = 037DA7091C79FF2300D8896F /* RYNumberKeyboard.xib */; }; 21 | 037DA70F1C79FF4000D8896F /* UITextField+RYNumberKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 037DA70E1C79FF4000D8896F /* UITextField+RYNumberKeyboard.m */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | 037DA6E11C79FEAC00D8896F /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = 037DA6BF1C79FEAC00D8896F /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = 037DA6C61C79FEAC00D8896F; 30 | remoteInfo = RYNumberKeyboardDemo; 31 | }; 32 | 037DA6EC1C79FEAC00D8896F /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 037DA6BF1C79FEAC00D8896F /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 037DA6C61C79FEAC00D8896F; 37 | remoteInfo = RYNumberKeyboardDemo; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 037DA6C71C79FEAC00D8896F /* RYNumberKeyboardDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RYNumberKeyboardDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 037DA6CB1C79FEAC00D8896F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 44 | 037DA6CD1C79FEAC00D8896F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 45 | 037DA6CE1C79FEAC00D8896F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 46 | 037DA6D01C79FEAC00D8896F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 47 | 037DA6D11C79FEAC00D8896F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 48 | 037DA6D41C79FEAC00D8896F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 49 | 037DA6D61C79FEAC00D8896F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 50 | 037DA6D91C79FEAC00D8896F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 51 | 037DA6DB1C79FEAC00D8896F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 037DA6E01C79FEAC00D8896F /* RYNumberKeyboardDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RYNumberKeyboardDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 037DA6E41C79FEAC00D8896F /* RYNumberKeyboardDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RYNumberKeyboardDemoTests.m; sourceTree = ""; }; 54 | 037DA6E61C79FEAC00D8896F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 037DA6EB1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RYNumberKeyboardDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 037DA6EF1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RYNumberKeyboardDemoUITests.m; sourceTree = ""; }; 57 | 037DA6F11C79FEAC00D8896F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | 037DA7061C79FF2300D8896F /* RYNumbeKeyboard.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = RYNumbeKeyboard.bundle; sourceTree = ""; }; 59 | 037DA7071C79FF2300D8896F /* RYNumberKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RYNumberKeyboard.h; sourceTree = ""; }; 60 | 037DA7081C79FF2300D8896F /* RYNumberKeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RYNumberKeyboard.m; sourceTree = ""; }; 61 | 037DA7091C79FF2300D8896F /* RYNumberKeyboard.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RYNumberKeyboard.xib; sourceTree = ""; }; 62 | 037DA70D1C79FF4000D8896F /* UITextField+RYNumberKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITextField+RYNumberKeyboard.h"; sourceTree = ""; }; 63 | 037DA70E1C79FF4000D8896F /* UITextField+RYNumberKeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITextField+RYNumberKeyboard.m"; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 037DA6C41C79FEAC00D8896F /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 037DA6DD1C79FEAC00D8896F /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | 037DA6E81C79FEAC00D8896F /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | ); 86 | runOnlyForDeploymentPostprocessing = 0; 87 | }; 88 | /* End PBXFrameworksBuildPhase section */ 89 | 90 | /* Begin PBXGroup section */ 91 | 037DA6BE1C79FEAC00D8896F = { 92 | isa = PBXGroup; 93 | children = ( 94 | 037DA7051C79FF2300D8896F /* RYNumberkeyboard */, 95 | 037DA6C91C79FEAC00D8896F /* RYNumberKeyboardDemo */, 96 | 037DA6E31C79FEAC00D8896F /* RYNumberKeyboardDemoTests */, 97 | 037DA6EE1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests */, 98 | 037DA6C81C79FEAC00D8896F /* Products */, 99 | ); 100 | sourceTree = ""; 101 | }; 102 | 037DA6C81C79FEAC00D8896F /* Products */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 037DA6C71C79FEAC00D8896F /* RYNumberKeyboardDemo.app */, 106 | 037DA6E01C79FEAC00D8896F /* RYNumberKeyboardDemoTests.xctest */, 107 | 037DA6EB1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests.xctest */, 108 | ); 109 | name = Products; 110 | sourceTree = ""; 111 | }; 112 | 037DA6C91C79FEAC00D8896F /* RYNumberKeyboardDemo */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 037DA6CD1C79FEAC00D8896F /* AppDelegate.h */, 116 | 037DA6CE1C79FEAC00D8896F /* AppDelegate.m */, 117 | 037DA6D01C79FEAC00D8896F /* ViewController.h */, 118 | 037DA6D11C79FEAC00D8896F /* ViewController.m */, 119 | 037DA6D31C79FEAC00D8896F /* Main.storyboard */, 120 | 037DA6D61C79FEAC00D8896F /* Assets.xcassets */, 121 | 037DA6D81C79FEAC00D8896F /* LaunchScreen.storyboard */, 122 | 037DA6DB1C79FEAC00D8896F /* Info.plist */, 123 | 037DA6CA1C79FEAC00D8896F /* Supporting Files */, 124 | ); 125 | path = RYNumberKeyboardDemo; 126 | sourceTree = ""; 127 | }; 128 | 037DA6CA1C79FEAC00D8896F /* Supporting Files */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 037DA6CB1C79FEAC00D8896F /* main.m */, 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | 037DA6E31C79FEAC00D8896F /* RYNumberKeyboardDemoTests */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 037DA6E41C79FEAC00D8896F /* RYNumberKeyboardDemoTests.m */, 140 | 037DA6E61C79FEAC00D8896F /* Info.plist */, 141 | ); 142 | path = RYNumberKeyboardDemoTests; 143 | sourceTree = ""; 144 | }; 145 | 037DA6EE1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 037DA6EF1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests.m */, 149 | 037DA6F11C79FEAC00D8896F /* Info.plist */, 150 | ); 151 | path = RYNumberKeyboardDemoUITests; 152 | sourceTree = ""; 153 | }; 154 | 037DA7051C79FF2300D8896F /* RYNumberkeyboard */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 037DA7061C79FF2300D8896F /* RYNumbeKeyboard.bundle */, 158 | 037DA70D1C79FF4000D8896F /* UITextField+RYNumberKeyboard.h */, 159 | 037DA70E1C79FF4000D8896F /* UITextField+RYNumberKeyboard.m */, 160 | 037DA7071C79FF2300D8896F /* RYNumberKeyboard.h */, 161 | 037DA7081C79FF2300D8896F /* RYNumberKeyboard.m */, 162 | 037DA7091C79FF2300D8896F /* RYNumberKeyboard.xib */, 163 | ); 164 | path = RYNumberkeyboard; 165 | sourceTree = ""; 166 | }; 167 | /* End PBXGroup section */ 168 | 169 | /* Begin PBXNativeTarget section */ 170 | 037DA6C61C79FEAC00D8896F /* RYNumberKeyboardDemo */ = { 171 | isa = PBXNativeTarget; 172 | buildConfigurationList = 037DA6F41C79FEAC00D8896F /* Build configuration list for PBXNativeTarget "RYNumberKeyboardDemo" */; 173 | buildPhases = ( 174 | 037DA6C31C79FEAC00D8896F /* Sources */, 175 | 037DA6C41C79FEAC00D8896F /* Frameworks */, 176 | 037DA6C51C79FEAC00D8896F /* Resources */, 177 | ); 178 | buildRules = ( 179 | ); 180 | dependencies = ( 181 | ); 182 | name = RYNumberKeyboardDemo; 183 | productName = RYNumberKeyboardDemo; 184 | productReference = 037DA6C71C79FEAC00D8896F /* RYNumberKeyboardDemo.app */; 185 | productType = "com.apple.product-type.application"; 186 | }; 187 | 037DA6DF1C79FEAC00D8896F /* RYNumberKeyboardDemoTests */ = { 188 | isa = PBXNativeTarget; 189 | buildConfigurationList = 037DA6F71C79FEAC00D8896F /* Build configuration list for PBXNativeTarget "RYNumberKeyboardDemoTests" */; 190 | buildPhases = ( 191 | 037DA6DC1C79FEAC00D8896F /* Sources */, 192 | 037DA6DD1C79FEAC00D8896F /* Frameworks */, 193 | 037DA6DE1C79FEAC00D8896F /* Resources */, 194 | ); 195 | buildRules = ( 196 | ); 197 | dependencies = ( 198 | 037DA6E21C79FEAC00D8896F /* PBXTargetDependency */, 199 | ); 200 | name = RYNumberKeyboardDemoTests; 201 | productName = RYNumberKeyboardDemoTests; 202 | productReference = 037DA6E01C79FEAC00D8896F /* RYNumberKeyboardDemoTests.xctest */; 203 | productType = "com.apple.product-type.bundle.unit-test"; 204 | }; 205 | 037DA6EA1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 037DA6FA1C79FEAC00D8896F /* Build configuration list for PBXNativeTarget "RYNumberKeyboardDemoUITests" */; 208 | buildPhases = ( 209 | 037DA6E71C79FEAC00D8896F /* Sources */, 210 | 037DA6E81C79FEAC00D8896F /* Frameworks */, 211 | 037DA6E91C79FEAC00D8896F /* Resources */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | 037DA6ED1C79FEAC00D8896F /* PBXTargetDependency */, 217 | ); 218 | name = RYNumberKeyboardDemoUITests; 219 | productName = RYNumberKeyboardDemoUITests; 220 | productReference = 037DA6EB1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests.xctest */; 221 | productType = "com.apple.product-type.bundle.ui-testing"; 222 | }; 223 | /* End PBXNativeTarget section */ 224 | 225 | /* Begin PBXProject section */ 226 | 037DA6BF1C79FEAC00D8896F /* Project object */ = { 227 | isa = PBXProject; 228 | attributes = { 229 | LastUpgradeCheck = 0720; 230 | ORGANIZATIONNAME = Resory; 231 | TargetAttributes = { 232 | 037DA6C61C79FEAC00D8896F = { 233 | CreatedOnToolsVersion = 7.2; 234 | DevelopmentTeam = EVEKBRZVFK; 235 | ProvisioningStyle = Automatic; 236 | }; 237 | 037DA6DF1C79FEAC00D8896F = { 238 | CreatedOnToolsVersion = 7.2; 239 | TestTargetID = 037DA6C61C79FEAC00D8896F; 240 | }; 241 | 037DA6EA1C79FEAC00D8896F = { 242 | CreatedOnToolsVersion = 7.2; 243 | TestTargetID = 037DA6C61C79FEAC00D8896F; 244 | }; 245 | }; 246 | }; 247 | buildConfigurationList = 037DA6C21C79FEAC00D8896F /* Build configuration list for PBXProject "RYNumberKeyboardDemo" */; 248 | compatibilityVersion = "Xcode 3.2"; 249 | developmentRegion = English; 250 | hasScannedForEncodings = 0; 251 | knownRegions = ( 252 | en, 253 | Base, 254 | ); 255 | mainGroup = 037DA6BE1C79FEAC00D8896F; 256 | productRefGroup = 037DA6C81C79FEAC00D8896F /* Products */; 257 | projectDirPath = ""; 258 | projectRoot = ""; 259 | targets = ( 260 | 037DA6C61C79FEAC00D8896F /* RYNumberKeyboardDemo */, 261 | 037DA6DF1C79FEAC00D8896F /* RYNumberKeyboardDemoTests */, 262 | 037DA6EA1C79FEAC00D8896F /* RYNumberKeyboardDemoUITests */, 263 | ); 264 | }; 265 | /* End PBXProject section */ 266 | 267 | /* Begin PBXResourcesBuildPhase section */ 268 | 037DA6C51C79FEAC00D8896F /* Resources */ = { 269 | isa = PBXResourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | 037DA6DA1C79FEAC00D8896F /* LaunchScreen.storyboard in Resources */, 273 | 037DA70A1C79FF2300D8896F /* RYNumbeKeyboard.bundle in Resources */, 274 | 037DA70C1C79FF2300D8896F /* RYNumberKeyboard.xib in Resources */, 275 | 037DA6D71C79FEAC00D8896F /* Assets.xcassets in Resources */, 276 | 037DA6D51C79FEAC00D8896F /* Main.storyboard in Resources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | 037DA6DE1C79FEAC00D8896F /* Resources */ = { 281 | isa = PBXResourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | 037DA6E91C79FEAC00D8896F /* Resources */ = { 288 | isa = PBXResourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | /* End PBXResourcesBuildPhase section */ 295 | 296 | /* Begin PBXSourcesBuildPhase section */ 297 | 037DA6C31C79FEAC00D8896F /* Sources */ = { 298 | isa = PBXSourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | 037DA6D21C79FEAC00D8896F /* ViewController.m in Sources */, 302 | 037DA6CF1C79FEAC00D8896F /* AppDelegate.m in Sources */, 303 | 037DA70F1C79FF4000D8896F /* UITextField+RYNumberKeyboard.m in Sources */, 304 | 037DA70B1C79FF2300D8896F /* RYNumberKeyboard.m in Sources */, 305 | 037DA6CC1C79FEAC00D8896F /* main.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | 037DA6DC1C79FEAC00D8896F /* Sources */ = { 310 | isa = PBXSourcesBuildPhase; 311 | buildActionMask = 2147483647; 312 | files = ( 313 | 037DA6E51C79FEAC00D8896F /* RYNumberKeyboardDemoTests.m in Sources */, 314 | ); 315 | runOnlyForDeploymentPostprocessing = 0; 316 | }; 317 | 037DA6E71C79FEAC00D8896F /* Sources */ = { 318 | isa = PBXSourcesBuildPhase; 319 | buildActionMask = 2147483647; 320 | files = ( 321 | 037DA6F01C79FEAC00D8896F /* RYNumberKeyboardDemoUITests.m in Sources */, 322 | ); 323 | runOnlyForDeploymentPostprocessing = 0; 324 | }; 325 | /* End PBXSourcesBuildPhase section */ 326 | 327 | /* Begin PBXTargetDependency section */ 328 | 037DA6E21C79FEAC00D8896F /* PBXTargetDependency */ = { 329 | isa = PBXTargetDependency; 330 | target = 037DA6C61C79FEAC00D8896F /* RYNumberKeyboardDemo */; 331 | targetProxy = 037DA6E11C79FEAC00D8896F /* PBXContainerItemProxy */; 332 | }; 333 | 037DA6ED1C79FEAC00D8896F /* PBXTargetDependency */ = { 334 | isa = PBXTargetDependency; 335 | target = 037DA6C61C79FEAC00D8896F /* RYNumberKeyboardDemo */; 336 | targetProxy = 037DA6EC1C79FEAC00D8896F /* PBXContainerItemProxy */; 337 | }; 338 | /* End PBXTargetDependency section */ 339 | 340 | /* Begin PBXVariantGroup section */ 341 | 037DA6D31C79FEAC00D8896F /* Main.storyboard */ = { 342 | isa = PBXVariantGroup; 343 | children = ( 344 | 037DA6D41C79FEAC00D8896F /* Base */, 345 | ); 346 | name = Main.storyboard; 347 | sourceTree = ""; 348 | }; 349 | 037DA6D81C79FEAC00D8896F /* LaunchScreen.storyboard */ = { 350 | isa = PBXVariantGroup; 351 | children = ( 352 | 037DA6D91C79FEAC00D8896F /* Base */, 353 | ); 354 | name = LaunchScreen.storyboard; 355 | sourceTree = ""; 356 | }; 357 | /* End PBXVariantGroup section */ 358 | 359 | /* Begin XCBuildConfiguration section */ 360 | 037DA6F21C79FEAC00D8896F /* Debug */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ALWAYS_SEARCH_USER_PATHS = NO; 364 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 365 | CLANG_CXX_LIBRARY = "libc++"; 366 | CLANG_ENABLE_MODULES = YES; 367 | CLANG_ENABLE_OBJC_ARC = YES; 368 | CLANG_WARN_BOOL_CONVERSION = YES; 369 | CLANG_WARN_CONSTANT_CONVERSION = YES; 370 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 371 | CLANG_WARN_EMPTY_BODY = YES; 372 | CLANG_WARN_ENUM_CONVERSION = YES; 373 | CLANG_WARN_INT_CONVERSION = YES; 374 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 375 | CLANG_WARN_UNREACHABLE_CODE = YES; 376 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 377 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 378 | COPY_PHASE_STRIP = NO; 379 | DEBUG_INFORMATION_FORMAT = dwarf; 380 | ENABLE_STRICT_OBJC_MSGSEND = YES; 381 | ENABLE_TESTABILITY = YES; 382 | GCC_C_LANGUAGE_STANDARD = gnu99; 383 | GCC_DYNAMIC_NO_PIC = NO; 384 | GCC_NO_COMMON_BLOCKS = YES; 385 | GCC_OPTIMIZATION_LEVEL = 0; 386 | GCC_PREPROCESSOR_DEFINITIONS = ( 387 | "DEBUG=1", 388 | "$(inherited)", 389 | ); 390 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 391 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 392 | GCC_WARN_UNDECLARED_SELECTOR = YES; 393 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 394 | GCC_WARN_UNUSED_FUNCTION = YES; 395 | GCC_WARN_UNUSED_VARIABLE = YES; 396 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 397 | MTL_ENABLE_DEBUG_INFO = YES; 398 | ONLY_ACTIVE_ARCH = YES; 399 | SDKROOT = iphoneos; 400 | }; 401 | name = Debug; 402 | }; 403 | 037DA6F31C79FEAC00D8896F /* Release */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | ALWAYS_SEARCH_USER_PATHS = NO; 407 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 408 | CLANG_CXX_LIBRARY = "libc++"; 409 | CLANG_ENABLE_MODULES = YES; 410 | CLANG_ENABLE_OBJC_ARC = YES; 411 | CLANG_WARN_BOOL_CONVERSION = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 414 | CLANG_WARN_EMPTY_BODY = YES; 415 | CLANG_WARN_ENUM_CONVERSION = YES; 416 | CLANG_WARN_INT_CONVERSION = YES; 417 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 418 | CLANG_WARN_UNREACHABLE_CODE = YES; 419 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 420 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 421 | COPY_PHASE_STRIP = NO; 422 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 423 | ENABLE_NS_ASSERTIONS = NO; 424 | ENABLE_STRICT_OBJC_MSGSEND = YES; 425 | GCC_C_LANGUAGE_STANDARD = gnu99; 426 | GCC_NO_COMMON_BLOCKS = YES; 427 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 428 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 429 | GCC_WARN_UNDECLARED_SELECTOR = YES; 430 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 431 | GCC_WARN_UNUSED_FUNCTION = YES; 432 | GCC_WARN_UNUSED_VARIABLE = YES; 433 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 434 | MTL_ENABLE_DEBUG_INFO = NO; 435 | SDKROOT = iphoneos; 436 | VALIDATE_PRODUCT = YES; 437 | }; 438 | name = Release; 439 | }; 440 | 037DA6F51C79FEAC00D8896F /* Debug */ = { 441 | isa = XCBuildConfiguration; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CODE_SIGN_IDENTITY = "iPhone Developer"; 445 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 446 | DEVELOPMENT_TEAM = EVEKBRZVFK; 447 | INFOPLIST_FILE = RYNumberKeyboardDemo/Info.plist; 448 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 449 | PRODUCT_BUNDLE_IDENTIFIER = com.resory.RYNumberKeyboardDemo; 450 | PRODUCT_NAME = "$(TARGET_NAME)"; 451 | PROVISIONING_PROFILE = ""; 452 | PROVISIONING_PROFILE_SPECIFIER = ""; 453 | }; 454 | name = Debug; 455 | }; 456 | 037DA6F61C79FEAC00D8896F /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 460 | CODE_SIGN_IDENTITY = "iPhone Developer"; 461 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 462 | DEVELOPMENT_TEAM = EVEKBRZVFK; 463 | INFOPLIST_FILE = RYNumberKeyboardDemo/Info.plist; 464 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 465 | PRODUCT_BUNDLE_IDENTIFIER = com.resory.RYNumberKeyboardDemo; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | PROVISIONING_PROFILE = ""; 468 | PROVISIONING_PROFILE_SPECIFIER = ""; 469 | }; 470 | name = Release; 471 | }; 472 | 037DA6F81C79FEAC00D8896F /* Debug */ = { 473 | isa = XCBuildConfiguration; 474 | buildSettings = { 475 | BUNDLE_LOADER = "$(TEST_HOST)"; 476 | INFOPLIST_FILE = RYNumberKeyboardDemoTests/Info.plist; 477 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 478 | PRODUCT_BUNDLE_IDENTIFIER = com.resory.RYNumberKeyboardDemoTests; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RYNumberKeyboardDemo.app/RYNumberKeyboardDemo"; 481 | }; 482 | name = Debug; 483 | }; 484 | 037DA6F91C79FEAC00D8896F /* Release */ = { 485 | isa = XCBuildConfiguration; 486 | buildSettings = { 487 | BUNDLE_LOADER = "$(TEST_HOST)"; 488 | INFOPLIST_FILE = RYNumberKeyboardDemoTests/Info.plist; 489 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 490 | PRODUCT_BUNDLE_IDENTIFIER = com.resory.RYNumberKeyboardDemoTests; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RYNumberKeyboardDemo.app/RYNumberKeyboardDemo"; 493 | }; 494 | name = Release; 495 | }; 496 | 037DA6FB1C79FEAC00D8896F /* Debug */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | INFOPLIST_FILE = RYNumberKeyboardDemoUITests/Info.plist; 500 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 501 | PRODUCT_BUNDLE_IDENTIFIER = com.resory.RYNumberKeyboardDemoUITests; 502 | PRODUCT_NAME = "$(TARGET_NAME)"; 503 | TEST_TARGET_NAME = RYNumberKeyboardDemo; 504 | USES_XCTRUNNER = YES; 505 | }; 506 | name = Debug; 507 | }; 508 | 037DA6FC1C79FEAC00D8896F /* Release */ = { 509 | isa = XCBuildConfiguration; 510 | buildSettings = { 511 | INFOPLIST_FILE = RYNumberKeyboardDemoUITests/Info.plist; 512 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 513 | PRODUCT_BUNDLE_IDENTIFIER = com.resory.RYNumberKeyboardDemoUITests; 514 | PRODUCT_NAME = "$(TARGET_NAME)"; 515 | TEST_TARGET_NAME = RYNumberKeyboardDemo; 516 | USES_XCTRUNNER = YES; 517 | }; 518 | name = Release; 519 | }; 520 | /* End XCBuildConfiguration section */ 521 | 522 | /* Begin XCConfigurationList section */ 523 | 037DA6C21C79FEAC00D8896F /* Build configuration list for PBXProject "RYNumberKeyboardDemo" */ = { 524 | isa = XCConfigurationList; 525 | buildConfigurations = ( 526 | 037DA6F21C79FEAC00D8896F /* Debug */, 527 | 037DA6F31C79FEAC00D8896F /* Release */, 528 | ); 529 | defaultConfigurationIsVisible = 0; 530 | defaultConfigurationName = Release; 531 | }; 532 | 037DA6F41C79FEAC00D8896F /* Build configuration list for PBXNativeTarget "RYNumberKeyboardDemo" */ = { 533 | isa = XCConfigurationList; 534 | buildConfigurations = ( 535 | 037DA6F51C79FEAC00D8896F /* Debug */, 536 | 037DA6F61C79FEAC00D8896F /* Release */, 537 | ); 538 | defaultConfigurationIsVisible = 0; 539 | defaultConfigurationName = Release; 540 | }; 541 | 037DA6F71C79FEAC00D8896F /* Build configuration list for PBXNativeTarget "RYNumberKeyboardDemoTests" */ = { 542 | isa = XCConfigurationList; 543 | buildConfigurations = ( 544 | 037DA6F81C79FEAC00D8896F /* Debug */, 545 | 037DA6F91C79FEAC00D8896F /* Release */, 546 | ); 547 | defaultConfigurationIsVisible = 0; 548 | defaultConfigurationName = Release; 549 | }; 550 | 037DA6FA1C79FEAC00D8896F /* Build configuration list for PBXNativeTarget "RYNumberKeyboardDemoUITests" */ = { 551 | isa = XCConfigurationList; 552 | buildConfigurations = ( 553 | 037DA6FB1C79FEAC00D8896F /* Debug */, 554 | 037DA6FC1C79FEAC00D8896F /* Release */, 555 | ); 556 | defaultConfigurationIsVisible = 0; 557 | defaultConfigurationName = Release; 558 | }; 559 | /* End XCConfigurationList section */ 560 | }; 561 | rootObject = 037DA6BF1C79FEAC00D8896F /* Project object */; 562 | } 563 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // RYNumberKeyboardDemo 4 | // 5 | // Created by Resory on 16/2/21. 6 | // Copyright © 2016年 Resory. 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 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // RYNumberKeyboardDemo 4 | // 5 | // Created by Resory on 16/2/21. 6 | // Copyright © 2016年 Resory. 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 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // 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. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo/Assets.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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo/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 | 27 | 28 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // RYNumberKeyboardDemo 4 | // 5 | // Created by Resory on 16/2/21. 6 | // Copyright © 2016年 Resory. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // RYNumberKeyboardDemo 4 | // 5 | // Created by Resory on 16/2/21. 6 | // Copyright © 2016年 Resory. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "RYNumberKeyboard.h" 11 | #import "UITextField+RYNumberKeyboard.h" 12 | 13 | @interface ViewController () 14 | 15 | @property (weak, nonatomic) IBOutlet UITextField *textFiled; 16 | @property (weak, nonatomic) IBOutlet UITextField *textFiledTwo; 17 | @property (weak, nonatomic) IBOutlet UITextField *textFiledThree; 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | 26 | self.textFiled.ry_inputType = RYIntInputType; 27 | self.textFiledTwo.ry_inputType = RYIDCardInputType; 28 | self.textFiledThree.ry_inputType = RYFloatInputType; 29 | 30 | self.textFiled.ry_interval = 4; 31 | self.textFiledTwo.ry_interval = 6; 32 | 33 | self.textFiled.ry_inputAccessoryText = @"请输入银行卡号"; 34 | self.textFiledTwo.ry_inputAccessoryText = @"请输入身份证号"; 35 | // Do any additional setup after loading the view, typically from a nib. 36 | } 37 | 38 | - (void)didReceiveMemoryWarning { 39 | [super didReceiveMemoryWarning]; 40 | // Dispose of any resources that can be recreated. 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RYNumberKeyboardDemo 4 | // 5 | // Created by Resory on 16/2/21. 6 | // Copyright © 2016年 Resory. 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 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemoTests/RYNumberKeyboardDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RYNumberKeyboardDemoTests.m 3 | // RYNumberKeyboardDemoTests 4 | // 5 | // Created by Resory on 16/2/21. 6 | // Copyright © 2016年 Resory. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RYNumberKeyboardDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation RYNumberKeyboardDemoTests 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 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberKeyboardDemoUITests/RYNumberKeyboardDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RYNumberKeyboardDemoUITests.m 3 | // RYNumberKeyboardDemoUITests 4 | // 5 | // Created by Resory on 16/2/21. 6 | // Copyright © 2016年 Resory. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RYNumberKeyboardDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation RYNumberKeyboardDemoUITests 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 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberkeyboard/RYNumbeKeyboard.bundle/image/delete@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Resory/RYNumberKeyboard/c8a5670c5e27f13f1a5c75e3fb5473fd061b3dff/RYNumberKeyboardDemo/RYNumberkeyboard/RYNumbeKeyboard.bundle/image/delete@2x.png -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberkeyboard/RYNumbeKeyboard.bundle/image/delete@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Resory/RYNumberKeyboard/c8a5670c5e27f13f1a5c75e3fb5473fd061b3dff/RYNumberKeyboardDemo/RYNumberkeyboard/RYNumbeKeyboard.bundle/image/delete@3x.png -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberkeyboard/RYNumbeKeyboard.bundle/image/resign@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Resory/RYNumberKeyboard/c8a5670c5e27f13f1a5c75e3fb5473fd061b3dff/RYNumberKeyboardDemo/RYNumberkeyboard/RYNumbeKeyboard.bundle/image/resign@2x.png -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberkeyboard/RYNumbeKeyboard.bundle/image/resign@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Resory/RYNumberKeyboard/c8a5670c5e27f13f1a5c75e3fb5473fd061b3dff/RYNumberKeyboardDemo/RYNumberkeyboard/RYNumbeKeyboard.bundle/image/resign@3x.png -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberkeyboard/RYNumberKeyboard.h: -------------------------------------------------------------------------------- 1 | // 2 | // RYNumberKeyBoard.h 3 | // RYNumberKeyboardDemo 4 | // 5 | // Created by Resory on 16/2/20. 6 | // Copyright © 2016年 Resory. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define SYS_DEVICE_WIDTH ([[UIScreen mainScreen] bounds].size.width) //屏幕宽度 12 | #define SYS_DEVICE_HEIGHT ([[UIScreen mainScreen] bounds].size.height) //屏幕长度 13 | 14 | typedef NS_ENUM(NSUInteger, RYInputType) { 15 | RYIntInputType, // 整数键盘 16 | RYFloatInputType, // 浮点数键盘 17 | RYIDCardInputType, // 身份证键盘 18 | }; 19 | 20 | @interface RYNumberKeyboard : UIView 21 | 22 | @property (nonatomic, weak) UITextField *textInput; 23 | @property (nonatomic, assign) RYInputType inputType; // 键盘类型 24 | @property (nonatomic, strong) NSNumber *interval; // 每隔多少个数字空一格 25 | 26 | - (id)initWithInputType:(RYInputType)inputType; 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberkeyboard/RYNumberKeyboard.m: -------------------------------------------------------------------------------- 1 | // 2 | // RYNumberKeyBoard.m 3 | // RYNumberKeyboardDemo 4 | // 5 | // Created by Resory on 16/2/20. 6 | // Copyright © 2016年 Resory. All rights reserved. 7 | // 8 | 9 | #import "RYNumberkeyboard.h" 10 | 11 | @interface RYNumberKeyboard () 12 | 13 | @property (strong, nonatomic) IBOutlet UIView *keyboardView; 14 | @property (weak, nonatomic) IBOutlet UIButton *deleteBtn; 15 | 16 | @end 17 | 18 | @implementation RYNumberKeyboard 19 | 20 | - (id)initWithInputType:(RYInputType)inputType 21 | { 22 | self = [super init]; 23 | 24 | if(self) 25 | { 26 | // 通知 27 | // [[NSNotificationCenter defaultCenter] addObserver:self 28 | // selector:@selector(editingDidBegin:) 29 | // name:UITextFieldTextDidBeginEditingNotification 30 | // object:nil]; 31 | // [[NSNotificationCenter defaultCenter] addObserver:self 32 | // selector:@selector(editingDidEnd:) 33 | // name:UITextFieldTextDidEndEditingNotification 34 | // object:nil]; 35 | 36 | // 添加keyboardview 37 | [[NSBundle mainBundle] loadNibNamed:@"RYNumberKeyboard" owner:self options:nil]; 38 | self.frame = CGRectMake(0, 0, SYS_DEVICE_WIDTH, 216); 39 | self.keyboardView.frame = self.frame; 40 | [self addSubview:self.keyboardView]; 41 | 42 | // 设置图片 43 | [self.deleteBtn setImage:[UIImage imageNamed:@"RYNumbeKeyboard.bundle/image/delete.png"] 44 | forState:UIControlStateNormal]; 45 | 46 | self.inputType = inputType; 47 | } 48 | 49 | return self; 50 | } 51 | 52 | - (void)setInterval:(NSNumber *)interval 53 | { 54 | _interval = interval; 55 | } 56 | 57 | - (void)setInputType:(RYInputType)inputType 58 | { 59 | UIButton *xBtn = [self viewWithTag:1011]; 60 | UIButton *dotBtn = [self viewWithTag:1010]; 61 | 62 | _inputType = inputType; 63 | 64 | switch (inputType) 65 | { 66 | // 浮点数键盘 67 | case RYFloatInputType: 68 | { 69 | xBtn.hidden = YES; 70 | dotBtn.hidden = NO; 71 | break; 72 | } 73 | // 身份证键盘 74 | case RYIDCardInputType: 75 | { 76 | xBtn.hidden = NO; 77 | dotBtn.hidden = YES; 78 | break; 79 | } 80 | // 数字键盘 81 | default: 82 | { 83 | xBtn.hidden = YES; 84 | dotBtn.hidden = YES; 85 | break; 86 | } 87 | } 88 | } 89 | 90 | - (IBAction)keyboardViewAction:(UIButton *)sender 91 | { 92 | NSInteger tag = sender.tag; 93 | 94 | switch (tag) 95 | { 96 | case 1010: 97 | { 98 | // 小数点 99 | if(self.textInput.text.length > 0 && ![self.textInput.text containsString:@"."]) 100 | [self.textInput insertText:@"."]; 101 | } 102 | break; 103 | case 1011: 104 | { 105 | // 身份证X 106 | if(self.textInput.text.length > 0 && ![self.textInput.text containsString:@"X"]) 107 | [self.textInput insertText:@"X"]; 108 | } 109 | break; 110 | case 1012: 111 | { 112 | // 删除 113 | if(self.textInput.text.length > 0) 114 | [self.textInput deleteBackward]; 115 | } 116 | break; 117 | case 1013: 118 | { 119 | // 确认 120 | [self.textInput resignFirstResponder]; 121 | } 122 | break; 123 | default: 124 | { 125 | // 数字 126 | NSString *text = [NSString stringWithFormat:@"%ld",sender.tag - 1000]; 127 | [self.textInput insertText:text]; 128 | 129 | if(self.interval && (self.textInput.text.length+1) % ([self.interval integerValue] + 1) == 0) 130 | [self.textInput insertText:@" "]; 131 | } 132 | break; 133 | } 134 | } 135 | 136 | #pragma mark - 137 | #pragma mark - Notification Action 138 | //- (void)editingDidBegin:(NSNotification *)notification { 139 | // if (![notification.object conformsToProtocol:@protocol(UITextInput)]) 140 | // { 141 | // self.textInput = nil; 142 | // return; 143 | // } 144 | // self.textInput = notification.object; 145 | //} 146 | // 147 | //- (void)editingDidEnd:(NSNotification *)notification 148 | //{ 149 | // self.textInput = nil; 150 | //} 151 | 152 | #pragma mark - 153 | #pragma mark - UIKeyInput Protocol 154 | 155 | 156 | /* 157 | // Only override drawRect: if you perform custom drawing. 158 | // An empty implementation adversely affects performance during animation. 159 | - (void)drawRect:(CGRect)rect { 160 | // Drawing code 161 | } 162 | */ 163 | 164 | @end 165 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberkeyboard/RYNumberKeyboard.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 36 | 49 | 62 | 75 | 87 | 100 | 113 | 126 | 139 | 152 | 165 | 177 | 190 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberkeyboard/UITextField+RYNumberKeyboard.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+RYNumberKeyboard.h 3 | // RYNumberKeyboardDemo 4 | // 5 | // Created by Resory on 16/2/21. 6 | // Copyright © 2016年 Resory. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "RYNumberKeyboard.h" 11 | 12 | @interface UITextField (RYNumberKeyboard) 13 | 14 | @property (nonatomic, assign) RYInputType ry_inputType; // 键盘类型 15 | @property (nonatomic, assign) NSInteger ry_interval; // 每隔多少个数字空一格 16 | @property (nonatomic, copy) NSString *ry_inputAccessoryText; // inputAccessoryView显示的文字 17 | 18 | @end 19 | 20 | 21 | -------------------------------------------------------------------------------- /RYNumberKeyboardDemo/RYNumberkeyboard/UITextField+RYNumberKeyboard.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+RYNumberKeyboard.m 3 | // RYNumberKeyboardDemo 4 | // 5 | // Created by Resory on 16/2/21. 6 | // Copyright © 2016年 Resory. All rights reserved. 7 | // 8 | 9 | #import "UITextField+RYNumberKeyboard.h" 10 | #import 11 | 12 | @implementation UITextField (RYNumberKeyboard) 13 | 14 | #pragma mark - 15 | #pragma mark - Setter 16 | 17 | - (void)setRy_inputType:(RYInputType)ry_inputType 18 | { 19 | RYNumberKeyboard *inputView = [[RYNumberKeyboard alloc] initWithInputType:ry_inputType]; 20 | inputView.textInput = self; 21 | self.inputView = inputView; 22 | objc_setAssociatedObject(self, _cmd, @(ry_inputType), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 23 | } 24 | 25 | - (void)setRy_interval:(NSInteger)ry_interval 26 | { 27 | if([self.inputView isKindOfClass:[RYNumberKeyboard class]]) 28 | [self.inputView performSelector:@selector(setInterval:) withObject:@(ry_interval)]; 29 | objc_setAssociatedObject(self, _cmd, @(ry_interval), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 30 | } 31 | 32 | - (void)setRy_inputAccessoryText:(NSString *)ry_inputAccessoryText 33 | { 34 | // inputAccessoryView 35 | UIView *tView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SYS_DEVICE_WIDTH, 35)]; 36 | // 顶部分割线 37 | UIView *tLine = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SYS_DEVICE_WIDTH, 0.5)]; 38 | tLine.backgroundColor = [UIColor colorWithRed:210/255.0 green:210/255.0 blue:210/255.0 alpha:1.0]; 39 | // 字体label 40 | UILabel *tLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SYS_DEVICE_WIDTH, 35)]; 41 | tLabel.text = ry_inputAccessoryText; 42 | tLabel.textAlignment = NSTextAlignmentCenter; 43 | tLabel.font = [UIFont systemFontOfSize:14.0]; 44 | tLabel.backgroundColor = [UIColor whiteColor]; 45 | 46 | [tView addSubview:tLabel]; 47 | [tView addSubview:tLine]; 48 | self.inputAccessoryView = tView; 49 | objc_setAssociatedObject(self, _cmd, ry_inputAccessoryText, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 50 | } 51 | 52 | #pragma mark - 53 | #pragma mark - Getter 54 | 55 | - (RYInputType)ry_inputType 56 | { 57 | return [objc_getAssociatedObject(self, @selector(setRy_inputType:)) integerValue]; 58 | } 59 | 60 | - (NSInteger)ry_interval 61 | { 62 | return [objc_getAssociatedObject(self, @selector(setRy_interval:)) integerValue]; 63 | } 64 | 65 | - (NSString *)ry_inputAccessoryText 66 | { 67 | return objc_getAssociatedObject(self, @selector(ry_inputAccessoryText)); 68 | } 69 | 70 | 71 | 72 | @end 73 | --------------------------------------------------------------------------------