├── AmountKeyboard.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── zbwu.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── AmountKeyboard.xcscheme │ └── xcschememanagement.plist ├── AmountKeyboard ├── AmountKeyboard │ ├── AmountKeyboard.h │ ├── AmountKeyboard.m │ ├── YUButton.h │ └── YUButton.m ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── amount_120px-1.png │ │ ├── amount_120px.png │ │ ├── amount_180px.png │ │ ├── amount_80px.png │ │ └── amount_87px.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m ├── amount.gif └── main.m └── README.md /AmountKeyboard.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6B17A49D1C57B714002BF276 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B17A49C1C57B714002BF276 /* main.m */; }; 11 | 6B17A4A01C57B714002BF276 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B17A49F1C57B714002BF276 /* AppDelegate.m */; }; 12 | 6B17A4A31C57B714002BF276 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B17A4A21C57B714002BF276 /* ViewController.m */; }; 13 | 6B17A4A61C57B714002BF276 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B17A4A41C57B714002BF276 /* Main.storyboard */; }; 14 | 6B17A4A81C57B714002BF276 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6B17A4A71C57B714002BF276 /* Assets.xcassets */; }; 15 | 6B17A4AB1C57B714002BF276 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B17A4A91C57B714002BF276 /* LaunchScreen.storyboard */; }; 16 | 6B17A4B51C57B7D7002BF276 /* AmountKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B17A4B41C57B7D7002BF276 /* AmountKeyboard.m */; }; 17 | 6B17A4B81C57B803002BF276 /* YUButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B17A4B71C57B803002BF276 /* YUButton.m */; }; 18 | 6B17A4BC1C58B533002BF276 /* amount.gif in Resources */ = {isa = PBXBuildFile; fileRef = 6B17A4BB1C58B533002BF276 /* amount.gif */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 6B17A4981C57B714002BF276 /* AmountKeyboard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmountKeyboard.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 6B17A49C1C57B714002BF276 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 24 | 6B17A49E1C57B714002BF276 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 25 | 6B17A49F1C57B714002BF276 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 26 | 6B17A4A11C57B714002BF276 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 27 | 6B17A4A21C57B714002BF276 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 28 | 6B17A4A51C57B714002BF276 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 29 | 6B17A4A71C57B714002BF276 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | 6B17A4AA1C57B714002BF276 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 31 | 6B17A4AC1C57B714002BF276 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 6B17A4B31C57B7D7002BF276 /* AmountKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AmountKeyboard.h; sourceTree = ""; }; 33 | 6B17A4B41C57B7D7002BF276 /* AmountKeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AmountKeyboard.m; sourceTree = ""; }; 34 | 6B17A4B61C57B803002BF276 /* YUButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YUButton.h; sourceTree = ""; }; 35 | 6B17A4B71C57B803002BF276 /* YUButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YUButton.m; sourceTree = ""; }; 36 | 6B17A4BB1C58B533002BF276 /* amount.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = amount.gif; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | 6B17A4951C57B714002BF276 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | 6B17A48F1C57B714002BF276 = { 51 | isa = PBXGroup; 52 | children = ( 53 | 6B17A49A1C57B714002BF276 /* AmountKeyboard */, 54 | 6B17A4991C57B714002BF276 /* Products */, 55 | ); 56 | sourceTree = ""; 57 | }; 58 | 6B17A4991C57B714002BF276 /* Products */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 6B17A4981C57B714002BF276 /* AmountKeyboard.app */, 62 | ); 63 | name = Products; 64 | sourceTree = ""; 65 | }; 66 | 6B17A49A1C57B714002BF276 /* AmountKeyboard */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 6B17A4B21C57B7B5002BF276 /* AmountKeyboard */, 70 | 6B17A49E1C57B714002BF276 /* AppDelegate.h */, 71 | 6B17A49F1C57B714002BF276 /* AppDelegate.m */, 72 | 6B17A4A11C57B714002BF276 /* ViewController.h */, 73 | 6B17A4A21C57B714002BF276 /* ViewController.m */, 74 | 6B17A4A41C57B714002BF276 /* Main.storyboard */, 75 | 6B17A4A71C57B714002BF276 /* Assets.xcassets */, 76 | 6B17A4A91C57B714002BF276 /* LaunchScreen.storyboard */, 77 | 6B17A4AC1C57B714002BF276 /* Info.plist */, 78 | 6B17A49B1C57B714002BF276 /* Supporting Files */, 79 | ); 80 | path = AmountKeyboard; 81 | sourceTree = ""; 82 | }; 83 | 6B17A49B1C57B714002BF276 /* Supporting Files */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 6B17A4BB1C58B533002BF276 /* amount.gif */, 87 | 6B17A49C1C57B714002BF276 /* main.m */, 88 | ); 89 | name = "Supporting Files"; 90 | sourceTree = ""; 91 | }; 92 | 6B17A4B21C57B7B5002BF276 /* AmountKeyboard */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 6B17A4B31C57B7D7002BF276 /* AmountKeyboard.h */, 96 | 6B17A4B41C57B7D7002BF276 /* AmountKeyboard.m */, 97 | 6B17A4B61C57B803002BF276 /* YUButton.h */, 98 | 6B17A4B71C57B803002BF276 /* YUButton.m */, 99 | ); 100 | path = AmountKeyboard; 101 | sourceTree = ""; 102 | }; 103 | /* End PBXGroup section */ 104 | 105 | /* Begin PBXNativeTarget section */ 106 | 6B17A4971C57B714002BF276 /* AmountKeyboard */ = { 107 | isa = PBXNativeTarget; 108 | buildConfigurationList = 6B17A4AF1C57B714002BF276 /* Build configuration list for PBXNativeTarget "AmountKeyboard" */; 109 | buildPhases = ( 110 | 6B17A4941C57B714002BF276 /* Sources */, 111 | 6B17A4951C57B714002BF276 /* Frameworks */, 112 | 6B17A4961C57B714002BF276 /* Resources */, 113 | ); 114 | buildRules = ( 115 | ); 116 | dependencies = ( 117 | ); 118 | name = AmountKeyboard; 119 | productName = AmountKeyboard; 120 | productReference = 6B17A4981C57B714002BF276 /* AmountKeyboard.app */; 121 | productType = "com.apple.product-type.application"; 122 | }; 123 | /* End PBXNativeTarget section */ 124 | 125 | /* Begin PBXProject section */ 126 | 6B17A4901C57B714002BF276 /* Project object */ = { 127 | isa = PBXProject; 128 | attributes = { 129 | LastUpgradeCheck = 0720; 130 | ORGANIZATIONNAME = yeyu; 131 | TargetAttributes = { 132 | 6B17A4971C57B714002BF276 = { 133 | CreatedOnToolsVersion = 7.2; 134 | }; 135 | }; 136 | }; 137 | buildConfigurationList = 6B17A4931C57B714002BF276 /* Build configuration list for PBXProject "AmountKeyboard" */; 138 | compatibilityVersion = "Xcode 3.2"; 139 | developmentRegion = English; 140 | hasScannedForEncodings = 0; 141 | knownRegions = ( 142 | en, 143 | Base, 144 | ); 145 | mainGroup = 6B17A48F1C57B714002BF276; 146 | productRefGroup = 6B17A4991C57B714002BF276 /* Products */; 147 | projectDirPath = ""; 148 | projectRoot = ""; 149 | targets = ( 150 | 6B17A4971C57B714002BF276 /* AmountKeyboard */, 151 | ); 152 | }; 153 | /* End PBXProject section */ 154 | 155 | /* Begin PBXResourcesBuildPhase section */ 156 | 6B17A4961C57B714002BF276 /* Resources */ = { 157 | isa = PBXResourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | 6B17A4BC1C58B533002BF276 /* amount.gif in Resources */, 161 | 6B17A4AB1C57B714002BF276 /* LaunchScreen.storyboard in Resources */, 162 | 6B17A4A81C57B714002BF276 /* Assets.xcassets in Resources */, 163 | 6B17A4A61C57B714002BF276 /* Main.storyboard in Resources */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXResourcesBuildPhase section */ 168 | 169 | /* Begin PBXSourcesBuildPhase section */ 170 | 6B17A4941C57B714002BF276 /* Sources */ = { 171 | isa = PBXSourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | 6B17A4B81C57B803002BF276 /* YUButton.m in Sources */, 175 | 6B17A4A31C57B714002BF276 /* ViewController.m in Sources */, 176 | 6B17A4A01C57B714002BF276 /* AppDelegate.m in Sources */, 177 | 6B17A49D1C57B714002BF276 /* main.m in Sources */, 178 | 6B17A4B51C57B7D7002BF276 /* AmountKeyboard.m in Sources */, 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | }; 182 | /* End PBXSourcesBuildPhase section */ 183 | 184 | /* Begin PBXVariantGroup section */ 185 | 6B17A4A41C57B714002BF276 /* Main.storyboard */ = { 186 | isa = PBXVariantGroup; 187 | children = ( 188 | 6B17A4A51C57B714002BF276 /* Base */, 189 | ); 190 | name = Main.storyboard; 191 | sourceTree = ""; 192 | }; 193 | 6B17A4A91C57B714002BF276 /* LaunchScreen.storyboard */ = { 194 | isa = PBXVariantGroup; 195 | children = ( 196 | 6B17A4AA1C57B714002BF276 /* Base */, 197 | ); 198 | name = LaunchScreen.storyboard; 199 | sourceTree = ""; 200 | }; 201 | /* End PBXVariantGroup section */ 202 | 203 | /* Begin XCBuildConfiguration section */ 204 | 6B17A4AD1C57B714002BF276 /* Debug */ = { 205 | isa = XCBuildConfiguration; 206 | buildSettings = { 207 | ALWAYS_SEARCH_USER_PATHS = NO; 208 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 209 | CLANG_CXX_LIBRARY = "libc++"; 210 | CLANG_ENABLE_MODULES = YES; 211 | CLANG_ENABLE_OBJC_ARC = YES; 212 | CLANG_WARN_BOOL_CONVERSION = YES; 213 | CLANG_WARN_CONSTANT_CONVERSION = YES; 214 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 215 | CLANG_WARN_EMPTY_BODY = YES; 216 | CLANG_WARN_ENUM_CONVERSION = YES; 217 | CLANG_WARN_INT_CONVERSION = YES; 218 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 219 | CLANG_WARN_UNREACHABLE_CODE = YES; 220 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 221 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 222 | COPY_PHASE_STRIP = NO; 223 | DEBUG_INFORMATION_FORMAT = dwarf; 224 | ENABLE_STRICT_OBJC_MSGSEND = YES; 225 | ENABLE_TESTABILITY = YES; 226 | GCC_C_LANGUAGE_STANDARD = gnu99; 227 | GCC_DYNAMIC_NO_PIC = NO; 228 | GCC_NO_COMMON_BLOCKS = YES; 229 | GCC_OPTIMIZATION_LEVEL = 0; 230 | GCC_PREPROCESSOR_DEFINITIONS = ( 231 | "DEBUG=1", 232 | "$(inherited)", 233 | ); 234 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 236 | GCC_WARN_UNDECLARED_SELECTOR = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 238 | GCC_WARN_UNUSED_FUNCTION = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 241 | MTL_ENABLE_DEBUG_INFO = YES; 242 | ONLY_ACTIVE_ARCH = YES; 243 | SDKROOT = iphoneos; 244 | }; 245 | name = Debug; 246 | }; 247 | 6B17A4AE1C57B714002BF276 /* Release */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ALWAYS_SEARCH_USER_PATHS = NO; 251 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 252 | CLANG_CXX_LIBRARY = "libc++"; 253 | CLANG_ENABLE_MODULES = YES; 254 | CLANG_ENABLE_OBJC_ARC = YES; 255 | CLANG_WARN_BOOL_CONVERSION = YES; 256 | CLANG_WARN_CONSTANT_CONVERSION = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INT_CONVERSION = YES; 261 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 262 | CLANG_WARN_UNREACHABLE_CODE = YES; 263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 264 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu99; 270 | GCC_NO_COMMON_BLOCKS = YES; 271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 273 | GCC_WARN_UNDECLARED_SELECTOR = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 275 | GCC_WARN_UNUSED_FUNCTION = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 278 | MTL_ENABLE_DEBUG_INFO = NO; 279 | SDKROOT = iphoneos; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Release; 283 | }; 284 | 6B17A4B01C57B714002BF276 /* Debug */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 288 | INFOPLIST_FILE = AmountKeyboard/Info.plist; 289 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 290 | PRODUCT_BUNDLE_IDENTIFIER = com.yeyu.AmountKeyboard; 291 | PRODUCT_NAME = "$(TARGET_NAME)"; 292 | }; 293 | name = Debug; 294 | }; 295 | 6B17A4B11C57B714002BF276 /* Release */ = { 296 | isa = XCBuildConfiguration; 297 | buildSettings = { 298 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 299 | INFOPLIST_FILE = AmountKeyboard/Info.plist; 300 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 301 | PRODUCT_BUNDLE_IDENTIFIER = com.yeyu.AmountKeyboard; 302 | PRODUCT_NAME = "$(TARGET_NAME)"; 303 | }; 304 | name = Release; 305 | }; 306 | /* End XCBuildConfiguration section */ 307 | 308 | /* Begin XCConfigurationList section */ 309 | 6B17A4931C57B714002BF276 /* Build configuration list for PBXProject "AmountKeyboard" */ = { 310 | isa = XCConfigurationList; 311 | buildConfigurations = ( 312 | 6B17A4AD1C57B714002BF276 /* Debug */, 313 | 6B17A4AE1C57B714002BF276 /* Release */, 314 | ); 315 | defaultConfigurationIsVisible = 0; 316 | defaultConfigurationName = Release; 317 | }; 318 | 6B17A4AF1C57B714002BF276 /* Build configuration list for PBXNativeTarget "AmountKeyboard" */ = { 319 | isa = XCConfigurationList; 320 | buildConfigurations = ( 321 | 6B17A4B01C57B714002BF276 /* Debug */, 322 | 6B17A4B11C57B714002BF276 /* Release */, 323 | ); 324 | defaultConfigurationIsVisible = 0; 325 | }; 326 | /* End XCConfigurationList section */ 327 | }; 328 | rootObject = 6B17A4901C57B714002BF276 /* Project object */; 329 | } 330 | -------------------------------------------------------------------------------- /AmountKeyboard.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AmountKeyboard.xcodeproj/xcuserdata/zbwu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /AmountKeyboard.xcodeproj/xcuserdata/zbwu.xcuserdatad/xcschemes/AmountKeyboard.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /AmountKeyboard.xcodeproj/xcuserdata/zbwu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AmountKeyboard.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 6B17A4971C57B714002BF276 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /AmountKeyboard/AmountKeyboard/AmountKeyboard.h: -------------------------------------------------------------------------------- 1 | // 2 | // AmountKeyboard.h 3 | // AmountKeyboard 4 | // 5 | // Created by yeyu on 16/1/26. 6 | // Copyright © 2016年 yeyu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define SOUNDID 1306 12 | #define ScreenWidth ([[UIScreen mainScreen] bounds].size.width) 13 | 14 | #define RGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)] 15 | #define Color_Title RGBA(34, 34, 34, 1) 16 | #define Color_Border RGBA(206, 206, 206, 1) 17 | 18 | #define Font(F) [UIFont systemFontOfSize:(F)] 19 | #define FontBold(F) [UIFont boldSystemFontOfSize:(F)] 20 | 21 | @interface AmountKeyboard : UIView 22 | 23 | @property (nonatomic, copy) void (^changeTextBlock)(NSString *text); 24 | 25 | + (instancetype)initWithTextField:(UITextField *)textField; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /AmountKeyboard/AmountKeyboard/AmountKeyboard.m: -------------------------------------------------------------------------------- 1 | // 2 | // AmountKeyboard.m 3 | // AmountKeyboard 4 | // 5 | // Created by yeyu on 16/1/26. 6 | // Copyright © 2016年 yeyu. All rights reserved. 7 | // 8 | 9 | #import "AmountKeyboard.h" 10 | #import 11 | #import "YUButton.h" 12 | 13 | @interface AmountKeyboard () 14 | 15 | @property (nonatomic, assign) UITextField *textField; 16 | 17 | @end 18 | 19 | @implementation AmountKeyboard 20 | 21 | + (instancetype)initWithTextField:(UITextField *)textField 22 | { 23 | AmountKeyboard *numberKeyboard = [[AmountKeyboard alloc] init]; 24 | numberKeyboard.textField = textField; 25 | textField.inputView = numberKeyboard; 26 | 27 | return numberKeyboard; 28 | } 29 | 30 | - (instancetype)init 31 | { 32 | self = [super init]; 33 | 34 | self.frame = CGRectMake(0, 0, ScreenWidth, 200); 35 | 36 | NSArray *numbers = @[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@".",@"0",@"删除"]; 37 | 38 | CGFloat width = ScreenWidth/3.; 39 | CGFloat height = self.frame.size.height/4.; 40 | 41 | for (NSInteger i=0; i 3) { 137 | self.textField.text = [self.textField.text substringWithRange:NSMakeRange(0, range.location+3)]; 138 | } 139 | } 140 | } 141 | } 142 | 143 | self.changeTextBlock(self.textField.text); 144 | } 145 | 146 | @end 147 | -------------------------------------------------------------------------------- /AmountKeyboard/AmountKeyboard/YUButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // YUButton.h 3 | // AmountKeyboard 4 | // 5 | // Created by yeyu on 16/1/26. 6 | // Copyright © 2016年 yeyu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YUButton : UIButton 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AmountKeyboard/AmountKeyboard/YUButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // YUButton.m 3 | // AmountKeyboard 4 | // 5 | // Created by yeyu on 16/1/26. 6 | // Copyright © 2016年 yeyu. All rights reserved. 7 | // 8 | 9 | #import "YUButton.h" 10 | 11 | @interface YUButton () 12 | 13 | @property (nonatomic, strong) UIView *effectView; 14 | 15 | @end; 16 | 17 | @implementation YUButton 18 | 19 | - (UIView *)effectView 20 | { 21 | if (!_effectView) { 22 | _effectView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; 23 | _effectView.layer.cornerRadius = self.layer.cornerRadius; 24 | _effectView.layer.masksToBounds = self.layer.masksToBounds; 25 | _effectView.userInteractionEnabled = NO; 26 | _effectView.backgroundColor = [UIColor blackColor]; 27 | [self addSubview:_effectView]; 28 | } 29 | return _effectView; 30 | } 31 | 32 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 33 | { 34 | [super touchesBegan:touches withEvent:event]; 35 | 36 | self.effectView.alpha = 0.15; 37 | } 38 | 39 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 40 | { 41 | [super touchesEnded:touches withEvent:event]; 42 | 43 | self.effectView.alpha = 0; 44 | } 45 | 46 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event 47 | { 48 | [super touchesCancelled:touches withEvent:event]; 49 | 50 | self.effectView.alpha = 0; 51 | } 52 | 53 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 54 | { 55 | [super touchesMoved:touches withEvent:event]; 56 | 57 | CGPoint touchPoint = [[touches anyObject] locationInView:self]; 58 | 59 | float x = 60; 60 | if (!CGRectContainsPoint(CGRectMake(-x, -x, self.frame.size.width+2*x, self.frame.size.height+2*x), touchPoint)) 61 | { 62 | self.effectView.alpha = 0; 63 | 64 | }else { 65 | self.effectView.alpha = 0.15; 66 | } 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /AmountKeyboard/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AmountKeyboard 4 | // 5 | // Created by yeyu on 16/1/26. 6 | // Copyright © 2016年 yeyu. 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 | -------------------------------------------------------------------------------- /AmountKeyboard/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AmountKeyboard 4 | // 5 | // Created by yeyu on 16/1/26. 6 | // Copyright © 2016年 yeyu. 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 | -------------------------------------------------------------------------------- /AmountKeyboard/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "size" : "29x29", 10 | "idiom" : "iphone", 11 | "filename" : "amount_87px.png", 12 | "scale" : "3x" 13 | }, 14 | { 15 | "size" : "40x40", 16 | "idiom" : "iphone", 17 | "filename" : "amount_80px.png", 18 | "scale" : "2x" 19 | }, 20 | { 21 | "size" : "40x40", 22 | "idiom" : "iphone", 23 | "filename" : "amount_120px.png", 24 | "scale" : "3x" 25 | }, 26 | { 27 | "size" : "60x60", 28 | "idiom" : "iphone", 29 | "filename" : "amount_120px-1.png", 30 | "scale" : "2x" 31 | }, 32 | { 33 | "size" : "60x60", 34 | "idiom" : "iphone", 35 | "filename" : "amount_180px.png", 36 | "scale" : "3x" 37 | } 38 | ], 39 | "info" : { 40 | "version" : 1, 41 | "author" : "xcode" 42 | } 43 | } -------------------------------------------------------------------------------- /AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_120px-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderYeYu/AmountKeyboard/642081981450fb20f06697891f23c73cdeb01a9e/AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_120px-1.png -------------------------------------------------------------------------------- /AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_120px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderYeYu/AmountKeyboard/642081981450fb20f06697891f23c73cdeb01a9e/AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_120px.png -------------------------------------------------------------------------------- /AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_180px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderYeYu/AmountKeyboard/642081981450fb20f06697891f23c73cdeb01a9e/AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_180px.png -------------------------------------------------------------------------------- /AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_80px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderYeYu/AmountKeyboard/642081981450fb20f06697891f23c73cdeb01a9e/AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_80px.png -------------------------------------------------------------------------------- /AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_87px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderYeYu/AmountKeyboard/642081981450fb20f06697891f23c73cdeb01a9e/AmountKeyboard/Assets.xcassets/AppIcon.appiconset/amount_87px.png -------------------------------------------------------------------------------- /AmountKeyboard/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 29 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /AmountKeyboard/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 | -------------------------------------------------------------------------------- /AmountKeyboard/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 | 金额键盘 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 | -------------------------------------------------------------------------------- /AmountKeyboard/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AmountKeyboard 4 | // 5 | // Created by yeyu on 16/1/26. 6 | // Copyright © 2016年 yeyu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @property (weak, nonatomic) IBOutlet UITextField *amountTF; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /AmountKeyboard/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // AmountKeyboard 4 | // 5 | // Created by yeyu on 16/1/26. 6 | // Copyright © 2016年 yeyu. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "AmountKeyboard.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | self.view.backgroundColor = RGBA(240, 239, 245, 1); 22 | 23 | self.amountTF.placeholder = @"输入金额"; 24 | [self.amountTF becomeFirstResponder]; 25 | 26 | [AmountKeyboard initWithTextField:self.amountTF].changeTextBlock = ^(NSString *text) { 27 | NSLog(@"当前输入的金钱:%@",text); 28 | }; 29 | } 30 | 31 | - (void)didReceiveMemoryWarning { 32 | [super didReceiveMemoryWarning]; 33 | // Dispose of any resources that can be recreated. 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /AmountKeyboard/amount.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderYeYu/AmountKeyboard/642081981450fb20f06697891f23c73cdeb01a9e/AmountKeyboard/amount.gif -------------------------------------------------------------------------------- /AmountKeyboard/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AmountKeyboard 4 | // 5 | // Created by yeyu on 16/1/26. 6 | // Copyright © 2016年 yeyu. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AmountKeyboard 2 | 金额键盘,一个专为输入金额自定义的键盘。简单集成,使用inputView弹出键盘,block传递输入值。 3 | 4 | 5 | 演示: 6 | 7 | ![image](https://github.com/coderYeYu/AmountKeyboard/blob/master/AmountKeyboard/amount.gif) 8 | 9 | 使用方法: 10 | 11 | ```objc 12 | [AmountKeyboard amountKBWithTextField:self.amountTF].changeTextBlock = ^(NSString *text) { 13 | NSLog(@"当前输入的金钱:%@",text); 14 | }; 15 | ``` 16 | 17 | # 注 18 | 第一次分享自己demo,一个简单的自定义键盘。期待试用过的人可以提出一些改进的意见。 19 | --------------------------------------------------------------------------------