iOS 数字键盘:APNumberPad
jopen
10年前
APNumberPad是iOS 数字键盘完整克隆,并提供可定制的功能按钮。
// in .h: #import <APNumberPad/APNumberPad.h> @interface ExampleViewController : UIViewController <APNumberPadDelegate> // in .m: UITextField *textField = [[UITextField alloc] initWithFrame:CGRectZero]; textField.inputView = ({ APNumberPad *numberPad = [APNumberPad numberPadWithDelegate:self]; // configure function button // [numberPad.leftFunctionButton setTitle:@"Func" forState:UIControlStateNormal]; numberPad.leftFunctionButton.titleLabel.adjustsFontSizeToFitWidth = YES; numberPad; }); #pragma mark - APNumberPadDelegate - (void)numberPad:(APNumberPad *)numberPad functionButtonAction:(UIButton *)functionButton textInput:(UIResponder<UITextInput> *)textInput { [textInput insertText:@"#"]; }
特性:
- FULLY repeats default iOS keyboard look'n'feel (input with "tap by tap", pan over keyboard and release finger on button, holding clear button, ...)
- Device rotation
- Customizable left function button
- Customizable keyboard appearence (see
APNumberPad+Style.h
) UITextField
andUITextView
support (or any otherUIResponder
object that responds toUITextInput
protocol)- Input clicks