iOS 數字鍵盤:APNumberPad
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) UITextFieldandUITextViewsupport (or any otherUIResponderobject that responds toUITextInputprotocol)- Input clicks

本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!