iOS UITextField Source Code, UITextField Open Source Code, UITextField Code Examples

  • Growing TextView

    Text View,  UITextView,  TextView,  UITextField,  text field,  Multiple lines,  Autoresizing,  SMS
    Multi-line/Autoresizing UITextView similar to SMS-app, the height of the UITextView will be auto resized (enlarge) according to the length of input text.
  • Stepper TextField

    Stepper,  UITextField
    UIControl IOS stepper with numeric UITextField. Pressing "+" or "-" button will add or minus one for the number in the text field.
  • UITextField within Alert Prompt

    UIAlertView,  Alert,  AlertView,  Alert view,  UITextField,  password
    An UIAlertView subclass provides UITextFields for user/password inputs. Adding UITextField into UIAlertView.
  • Expandable Input TextView

    Text View,  UITextView,  TextView,  multi-line,  multiple lines,  Autoresizing,  UITextField,  text field
    An expandable input toolbar in the style of the native iPhone messages app. The input UITextField can expanded according to the length of the input text.
  • UIKeyboardCoView

    UITextView,  UITextField,  keyboard
    A UIView to appear along the iOS default keyboard. It manages also ROTATION when keyboard is present. For iOS4+. The UIKeyboardCoView is totally CUSTOMIZABLE. Just add one UIKeyboardCoView in your XIB and put anything you need inside it.
  • Digit Input

    UITextView,  UITextField,  digit,  digital
    The disadvantage of the standard picker view is that for example you want to enter the number 999999 but the control is currently on 555555 it will take some time to scroll to the desired value. An option would be to use an ordinary textfield. But if you want to change just the 3 digits in the middle it is also a paint cause you have to move the cursor, hit delete 3 times and then enter your new digits. Heres where CHDigitInput comes in. You get a configurable number of digits presented. When you tap on a digit a numpad shows up and you can immediately start entering a new digit, no matter if you want to change the first, the last or some digit in the middle. After setting a new value the focus goes to the next digit automatically until you reach the end or you dismiss the keyboard by yourself. So you are way faster than using a picker and way more comfortable than using an ordinary textview.
  • ZenKeyboard

    UITextView,  Text View,  UITextField,  Text Field,  digit input,  number
    ZenKeyboard is a custom iOS numeric keyboard, it's just like Square Register app.
  • Number PadView

    Text View,  UITextView,  Text Field,  UITextField,  TextView,  keyboard,  number,  digit
    A simple but highly customisable numeric keyboard for iPhone. Uses ARC. Currently does not support rotation, you are welcome to implement it. Includes some input checks to allow only 2 decimal digits, but you can easily change those checks to allow whatever input suits your app.
  • Swipe Shift Caret

    Text View,  UITextView,  TextView,  UITextField,  TextField,  Text Field,  swipe,  Caret
    Swipe-to-shift text input caret for iOS (no private APIs)
  • Keyboard Bar TextField

    Text Field,  UITextField,  TextField,  keyboard,  keyboard avoiding
    A self-contained alternative to sliding the entire view to keep a text field in view: move just the text field When the iOS keyboard is about to slide up and cover the input field it is for, Apple recommends you slide the appropriate container view up to keep the element visible. Most often that is the best experience for the user, as it keeps the context of what they are inputting in view. The practice of registering the view controller for keyboard event notifications and the mechanisms for smoothly keeping the field in view are well established, and are standard iOS developer techniques. However, sometimes it is just as well to leave the view alone and keep just the text field visible. Maybe additional context is not helpful, or other screen elements (near the top of the screen) are more important. Maybe you just want to deliver a different experience to your users. The EMKeyboardBarTextField was built for these cases. A subclass of UITextField, this control will listen for keyboard events, and when appropriate, will create a toolbar above the keyboard and place itself within it, with smooth animations to match the keyboard's show and hide events. If all text inputs in the view are EMKeyboardBarTextFields, the view controller no longer needs to observe keyboard events. EMKeyboardBarTextField is fully self-contained.
  • UITextField focus

    UITextField,  TextField,  Text Field,  glow,  focus
    When input in a UITextField, A glow focus will overlay on to the UITextField.
  • Autocomplete UITextField

    UITextField,  TextField,  Text Field,  Autocomplete,  Autocompletion
    HTAutocompleteTextField is a subclass of UITextField that automatically displays text suggestions in real-time. This is perfect for automatically suggesting the domain as a user types an email address.
  • TextView Placeholder

    Text View,  UITextView,  UITextField,  TextView,  placeholder,  default text
    A subclass of UITextView which simulates the effect of an actual placeholder as in UITextField. When the placeholder is active the cursor remains at the beginning of the text, making it impossible to change its position, select, copy or modify the text, paste text and autocorrect support as in UITextField.
  • Text Length Limit

    UITextField,  TextField,  Text Field,  fix length
    A UITextField category, makes it easy to limit the text length in the textfield.
  • DPTextField

    UITextField,  TextField,  Text Field,  form
    DPTextField is a replacement control for UITextField that provides several useful features, including: Previous/Next field toolbar buttons (with outlets that can be wired up in Interface Builder) unobtrusive and editable auto-fill functionality a Done toolbar button, and swipe gesture, to remove the keyboard without submitting a form set maximum characters allowed in field automatic handling of Next and Done return key types proper device rotation handling for iPhone and iPad correct handling of iPad's undocked keyboard
  • Autocomplete Bar

    ACEAutocompleteBar,  UITextField,  autocomplete,  autocompletion,  input hint
    ACEAutocompleteBar is a simple category of the UITextField. It automatically displays text suggestions in real-time on the top of the virtual keyboard. It uses a block to create the data source and can work well will an asynchronous API request.
  • RegEx TextField

    WTReTextField,  UITextField,  TextField,  Text Field,  Reg Ex,  RegEx,  regular expression,  format,  formatting
    You often need user to input some kind of formatted data: credit card number (4 groups of 4 digits divided with space, and user don't really want to type those spaces) date and time (and UIDatePicker is not really good enough for birthdays or expiration dates) sum with thousand separators phone number email address and many others UITextField doesn't really limit user input, so you need to do some validation afterwards, which is really annoying for multiple similar fields. WTReTextField is designed to validate and format user input while typing. It uses a regular expression pattern with quite familliar syntax.
  • Focus Color TextField

    UITextField,  TextField,  Text Field,  UITextView,  TextView,  Text View,  focus
    TextField and TextView having text and background color when focused.
  • SMTagField

    UITextField,  TextField,  Text field,  tag field,  tag
    SMTagField is an implementation of UITextField that allows for easy input/display of Tags.
  • iOS Validator

    UITextField,  TextField,  Text Field,  validate,  validator
    UITextField Validator for iOS.
  • WHMShakeTextField

    UITextField,  TextField,  Text Field,  validate
    Shaking the UITextField, which can be use to validate the input of the password.
  • BZGFormField

    UITextField,  TextField,  Text Field,  form,  form field,  input validation,  validate
    A text field with a validity indicator for better forms.
  • JVFloatLabeledTextField

    TextField,  UITextField,  Text Filed,  float label,  input text
    UITextField subclass with placeholders that change into floating labels when the field is populated with text.
  • Send Message ToolBar

    UITextField,  TextField,  Text Field,  Keyboard
    Add send message tool bar over the keyboard.
  • AKNumericFormatter

    UITextField,  TextField,  Text Field,  number,  digit,  format,  formatter
    Formatter for numerical fields and UITextField category to use it easily while editing.
  • TSCurrencyTextField

    UITextField,  TextField,  Text Field,  Currency,  Money
    TSCurrencyTextField is a UITextField subclass that behaves like an ATM currency-amount entry field: the user can enter decimal digits only and the field formats that input into a currency amount, complete with currency symbol ($), decimal point (.), and group separators (,).
  • SHEmailValidator

    UITextField,  TextField,  Text Field,  validate,  validator,  Email
    An iOS library that will provide basic email syntax validation as well as provide suggestions for possible typos (for example, test@gamil.con would be corrected to test@gmail.com).
  • MHTextField

    TextField,  UITextField,  Text Field,  Form,  Input Form,  Validation,  Toolbar,  Keyboard Avoiding
    MHTextField is an iOS drop-in class that extends UITextField with built-in toolbar, validation and scrolling support.
  • MBContactPicker

    UITextField,  TextField,  Adress,  Email,  E-mail,  Contact
    MBContactPicker is an implementation of a contact picker that looks like the one in Apple mail for iOS7. This can be dropped into any project, using interface builder and a few simple lines of code, you can have this custom contact picker into your app in very little time.
  • UITextField-Shake

    UITextField,  TextField,  Text Field,  Shake
    UITextField category that adds a shake animation like the password field of the OsX login screen.
  • BKMoneyKit

    BKMoneyKit,  UITextField,  credit card
    BKCardNumberField // create (you can also use interface builder) BKCardNumberField *cardNumberField = [[BKCardNumberField alloc] initWithFrame:CGRectMake(0, 0, 300, 40)]; cardNumberField.showsCardLogo = YES; [self.view addSubview:cardNumberField]; // get card number NSString *cardNumber = cardNumberField.cardNumber; // get card company name NSString *companyName = cardNumberField.cardCompanyName; BKCardExpiryField BKCardExpiryField *field = [[BKCardExpiryField alloc] init]; // get month NSInteger month = field.dateComponents.month; // get year NSInteger year = field.dateComponents.year; BKCurrencyTextField BKCurrencyTextField *field = [[BKCurrencyTextField alloc] init]; // change currency field.numberFormatter.currencyCode = @"KRW"; // get number value NSDecimalNumber *number = field.numberValue;
  • DIImageView

    DIImageView,  Image View,  UITextField
    DIImageView *imageView = [[DIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)]; [imageView setImage: [UIImage imageNamed:@"alley.jpg"]]; [self.view addSubview:imageView];
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
iOS 中,UITextField 的光标大小和颜色是由系统控制的,我们不能直接修改其大小,但是可以通过修改 UITextField 的 tint 属性来改变光标的颜色。 虽然不能直接修改光标大小,但我们可以通过设置 UITextField 的边框样式为 None,然后通过添加一个自定义的 UIView 作为光标来模拟实现。 以下是一个示例代码,可以在 UITextField 中添加一个自定义的光标: ```swift let customCursorView = UIView(frame: CGRect(x: 0, y: 0, width: 2, height: textField.frame.height)) customCursorView.backgroundColor = UIColor.red textField.tintColor = UIColor.clear textField.addSubview(customCursorView) ``` 在这个代码中,我们创建了一个自定义的 UIView,用于模拟光标。我们将其宽度设置为 2,高度设置为 UITextField 的高度,颜色设置为红色,并将其添加到 UITextField 上。最后,我们将 UITextField 的 tint 设置为 clear,以隐藏系统的光标。 需要注意的是,为了保证自定义光标的位置和系统光标的位置一致,我们还需要在 UITextField 的代理方法中添加以下代码: ```swift func textFieldDidChangeSelection(_ textField: UITextField) { if let selectedRange = textField.selectedTextRange { let cursorPosition = textField.offset(from: textField.beginningOfDocument, to: selectedRange.start) if let customCursorView = textField.subviews.last { customCursorView.frame.origin.x = textField.frame.origin.x + textField.textRect(forBounds: textField.bounds).origin.x + textField.font!.size(of: String(textField.text![..<textField.text!.index(textField.text!.startIndex, offsetBy: cursorPosition)]), constrainedToWidth: textField.frame.width).width } } } ``` 在这个代理方法中,我们获取了 UITextField 中被选中的文本范围,然后计算了光标在 UITextField 中的位置,并将自定义光标的位置进行了调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值