Questions tagged [uitextfield]

A UITextField object is a control that displays editable text and sends an action message to a target object when the user presses the return button. You typically use this class to gather small amounts of text from the user and perform some immediate action, such as a search operation, based on that text.

A UITextField object is a control that displays editable text and sends an action message to a target object when the user presses the return button. You typically use this class to gather small amounts of text from the user and perform some immediate action, such as a search operation, based on that text.

In addition to its basic text-editing behavior, the UITextField class supports the use of overlay views to display additional information (and provide additional command targets) inside the text field boundaries. You can use custom overlay views to display features such as a bookmarks button or search icon. The UITextField class also provides a built-in button for clearing the current text. A text field object supports the use of a delegate object to handle editing-related notifications.

Resources:

8508 questions
45
votes
15 answers

Right aligned UITextField spacebar does not advance cursor in iOS 7

In my iPad app, I noticed different behavior between iOS 6 and iOS 7 with UITextFields. I create the UITextField as follows: UIButton *theButton = (UIButton*)sender; UITextField *textField = [[UITextField alloc] initWithFrame:[theButton…
jkh
  • 3,618
  • 8
  • 38
  • 66
44
votes
3 answers

Why was UITextField's text property changed to an optional in Swift 2?

According to the UIKit diff document, in ios9/Swift 2 var text: String! has become var text: String? According to the documentation for UITextField it specficially says This string is @"" by default. I don't understand the purpose of this change.…
Will
  • 2,604
  • 2
  • 18
  • 14
44
votes
4 answers

Detect Focus Change for UITextField

I'm trying to set the animation for the view to move up when keyboard is hiding and appearing for the text fields and I got it to work perfectly fine, but when the focus moves from one text field to another, it doesn't work since the keyboard was…
Dennis
  • 3,506
  • 5
  • 34
  • 42
43
votes
6 answers

It is possible to show keyboard without using UITextField and UITextView iphone app?

I am working in iPhone messaging based app. I want to show keyboard with keyboard inputAccessoryView in keyboard without using UITextView and UITextField. It is possible to do this? Please any one help me on this. Thanks in advance. Looking…
Gopinath
  • 5,392
  • 21
  • 64
  • 97
42
votes
10 answers

How can I dismiss the keyboard if a user taps off the on-screen keyboard?

I want to be able to dismiss the iPhone keyboard when the user taps anywhere outside of the keyboard. How can I go about doing this? I know I need to dismiss the responder, but need to know how to implement it when a user taps out of the keyboard…
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
42
votes
7 answers

Add a button on right view of UItextfield in such way that, text should not overlap the button

I can add a button to a textfield on the right hand side of the UITextField using the right view however, the text overlaps on the button. Below is the code for right view button UIView.commitAnimations() var btnColor =…
Saty
  • 2,563
  • 3
  • 37
  • 88
41
votes
10 answers

Specify border radius of UITextField in Swift

I would like to programmatically specify the border radius of a UITextField using Swift. By default, a UITextField has a slight border radius, however I would like to increase it and, after trawling through Interface Builder, I assume this can be…
Daniel Bramhall
  • 1,451
  • 4
  • 18
  • 24
41
votes
8 answers

How to hide the shortcut bar in iOS9

I have a textfield with a hidden keyboard (since I'm using it with bluetooth). However, in iOS9 the shortcut bar keeps appearing. Is there a way to hide it too? Thank you so much!
Jordi Puigdellívol
  • 1,710
  • 3
  • 23
  • 31
41
votes
6 answers

Change color of cursor in UITextField

How can I change the color of the cursor in my UITextField?
monish
  • 443
  • 1
  • 4
  • 6
40
votes
10 answers

How to detect delete key on an UITextField in iOS 8?

I have subclassed UITextField and implemented the UIKeyInput protocol's deleteBackward method to detect backspace being pressed. This works fine on iOS 7 but not on iOS 8. deleteBackward is not called on the UITextField anymore when I press the…
VNVN
  • 501
  • 1
  • 4
  • 7
40
votes
10 answers

UITextField secureTextEntry bullets with a custom font?

I’m using a custom font in a UITextField, which has secureTextEntry turned on. When I’m typing in the cell, I see the bullets in my chosen font, but when the field loses focus, those bullets revert to the system standard font. If I tap the field…
Luke
  • 9,512
  • 15
  • 82
  • 146
40
votes
13 answers

How to make a UIScrollView auto scroll when a UITextField becomes a first responder

I've seen posts around here that suggest that UIScrollViews should automatically scroll if a subview UITextField becomes the first responder; however, I can't figure out how to get this to work. What I have is a UIViewController that has a…
Nosrettap
  • 10,940
  • 23
  • 85
  • 140
39
votes
7 answers

Custom UITextField clear button

Is it possible to customize the image of the clear button in a UITextField? I have a dark textfield background and the "x" is not visible enough.
gemini
  • 652
  • 1
  • 6
  • 11
39
votes
4 answers

Add UITextField on UIView programmatically

How to programmatically add UITextField on UIView in iPhone programming? UITextField* text; UIView* view = [[UIView alloc]init]; [view addSubview:???];
suse
  • 10,503
  • 23
  • 79
  • 113
39
votes
3 answers

How do I show the keyboard by default in UITextView?

I want to create a view that consists solely of a UITextView. When the view is first shown, by default, I'd like the keyboard to be visible and ready for text entry. This way, the user does not have to touch the UITextView first in order to begin…
bpapa
  • 21,409
  • 25
  • 99
  • 147