A versatile, highly customizable input view for iOS. It supports various text input customizations, including keyboard settings, caret styles, box alignment, and input length constraints. The view conforms to the UITextInput
protocol and offers a flexible, user-friendly text input experience suitable for a wide range of applications.
PopUp | DropDown |
---|---|
|
|
-
UITextInput Compliance
Supports various text input customizations such as autocapitalization, autocorrection, spell checking, and more. -
Caret Customization
Control the appearance and behavior of the caret, including width, height, blink duration, and opacity. -
Box Style Customization
Customize the appearance and alignment of input boxes, including space between boxes, select transition duration, and auto-fill options. -
Menu Actions
Support for copy, paste, cut, and delete actions within the input view. -
Input Handling
Manage the input length, current input index, and handle custom input events. -
First Responder Control
Toggle the first responder status programmatically.
inputLength
- The length of the input.
autocapitalizationType
- Controls whether text should be auto-capitalized.autocorrectionType
- Controls whether text should be auto-corrected.spellCheckingType
- Controls whether text should be spell-checked.smartQuotesType
- Controls whether smart quotes should be used.smartDashesType
- Controls whether smart dashes should be used.smartInsertDeleteType
- Controls whether smart insert/delete should be used.keyboardType
- The type of keyboard to display.keyboardAppearance
- The appearance style of the keyboard.returnKeyType
- The return key type for the keyboard.enablesReturnKeyAutomatically
- Controls whether the return key is automatically enabled.textContentType
- The type of content the text input represents.passwordRules
- The password rules for the text input.
copyable
- Controls whether text can be copied.pasteable
- Controls whether text can be pasted.cutable
- Controls whether text can be cut.deleteable
- Controls whether text can be deleted.setMenuable:
- Sets whether the text menu is enabled.
showCaret
- Controls whether the caret is shown.caretWidth
- The width of the caret.caretHeight
- The height of the caret.caretMaxOpacity
- The maximum opacity of the caret.caretMinOpacity
- The minimum opacity of the caret.blinkDuration
- The duration of the caret blink animation.
boxSpace
- The space between boxes.selectTransitionDuration
- The duration of the select transition animation.alignment
- The alignment of the boxes.autoDismissKeyBoardWhenFinishInput
- Controls whether the keyboard is automatically dismissed when input is finished.autoFillBoxContainer
- Controls whether the box container is automatically filled.isRTL
- Controls whether the text input is in right-to-left mode.placeHolder
- The placeholder text for the input.inputText
- The current input text.currentInputIndex
- The current input index (read-only).inputMaxLength
- The maximum length of the input (read-only).onClickInputViewBlock
- A block that is called when the input view is clicked.
initWithInputLength:
- Initializes the input view with a specified length.boxInputWithLength:
- Creates a new input view with a specified length.
#import "BRCBoxInputView.h"
// Create an input view with a specified length
BRCBoxInputView *inputView = [[BRCBoxInputView alloc] initWithInputLength:6];
// Customize appearance
inputView.autocapitalizationType = UITextAutocapitalizationTypeWords;
inputView.autocorrectionType = UITextAutocorrectionTypeNo;
inputView.keyboardType = UIKeyboardTypeNumberPad;
inputView.placeHolder = @"Enter Code";
// Set caret properties
inputView.showCaret = YES;
inputView.caretWidth = 2.0;
inputView.caretMaxOpacity = 1.0;
// Set box style properties
inputView.boxSpace = 8.0;
inputView.selectTransitionDuration = 0.25;
inputView.alignment = BRCBoxAlignmentCenter;
// Show the input view
[inputView toggleFirstResponder];
BRCBoxInputView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BRCBoxInputView', '~> 1.0'
iOS 13.0+ Xcode 12+
- iOS 13.0
- Xcode 12+
zhixiongsun, [email protected]
BRCBoxInputView is available under the MIT license. See the LICENSE file for more info.