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
60
votes
7 answers

How to change UITextField keyboard type to email in Swift

In objective-c I can just say the following. [self.promoTextField setKeyboardType:UIKeyboardTypeEmailAddress]; I tried googling it but just get ways to do it in objective-c.
user1898829
  • 3,437
  • 6
  • 34
  • 62
59
votes
15 answers

Formatting Phone number in Swift

I'm formatting my textfiled text once the user start typing the phone number into this format type 0 (555) 444 66 77 and it is working fine but once I get the number from the server I get it like this 05554446677 So please could you tell me how I…
CAN
  • 1,677
  • 4
  • 19
  • 28
57
votes
28 answers

UITextField with secure entry, always getting cleared before editing

I am having a weird issue in which my UITextField which holds a secure entry is always getting cleared when I try to edit it. I added 3 characters to the field, goes to another field and comes back, the cursor is in 4th character position, but when…
Nithin
  • 6,435
  • 5
  • 43
  • 56
57
votes
9 answers

Resize a UITextField while typing (by using Autolayout)

I have a UITableViewCell which has two UITextFields (without borders). The following constraints are used to set up the horizontal layout. @"|-10-[leftTextField(>=80)]-(>=10)-[rightTextField(>=40)]-10-|" Nothing fancy, and works as expected. As…
Matthias Bauch
  • 89,811
  • 20
  • 225
  • 247
56
votes
5 answers

UITextField Value Changed Event?

How can I make it so that when the contents of a text field changes, a function is called?
Christian Stewart
  • 15,217
  • 20
  • 82
  • 139
56
votes
25 answers

How to change the tint color of the clear button on a UITextField

I have an auto-generated clear button on my UITextfield, with the default blue tint color. I cannot change the tint color to white. I have tried modifying the storyboard and code without success, and I do not want to use a custom image. How can I…
Niels Robben
  • 1,637
  • 4
  • 17
  • 24
55
votes
9 answers

Disabling automatic scrolling of UITableView when editing UITextField inside UITableViewCell

I'm using custom UITableViewCells inside my UITableView. Each of these UITableViewCells is pretty high and contains a UITextField at the top. When a user taps the UITextField in order to edit it, a keyboard appears and the UITableView scrolls…
animal_chin
  • 6,610
  • 9
  • 37
  • 41
55
votes
4 answers

Drop Shadow on UITextField text

Is it possible to add a shadow to the text in a UITextField?
DotSlashSlash
  • 5,143
  • 5
  • 30
  • 32
54
votes
17 answers

How to disable copy paste option from UITextField programmatically

I am making a registration alertview that has a UITextField in it where the user can enter their registration number. everything is pretty much their, however I would like to remove the copy paste function from the textfield programmatically since…
C.Johns
  • 10,185
  • 20
  • 102
  • 156
54
votes
6 answers

iPhone: Issue disabling Auto-Cap/autocorrect on a UITextField

For some reason, even though I disable the auto-cap and auto-correct of my UITextField, it's still capitalizing the first letter of my input. Here is the code: UITextField* textField = [[[UITextField alloc] initWithFrame:CGRectMake(90.0, 10.0,…
phil swenson
  • 8,564
  • 20
  • 74
  • 99
54
votes
10 answers

UIKeyboard not appearing when tapping on UITextField

I had been into a weird problem, As every other thing is working fine. All of sudden when I compile my application and got this problem, when I tapped on the UITextField white space is popping up, but the keyboard is not visible and I am not able…
user3518271
54
votes
7 answers

UITextField: move view when keyboard appears

I'm currently working on an iPhone application with a single view, which has multiple UITextFields for input. When the keyboard shows, it overlays the bottom textfields. So I added the corresponding textFieldDidBeginEditing: method, to move the view…
ComSubVie
  • 1,609
  • 1
  • 16
  • 20
54
votes
1 answer

resignFirstResponder for all textfields

I'm working on an iphone app with multiple textfields on a viewcontroller. I'm a bit confused with resignfirstresponder and setting textfield delegates.I've been able to resign text fields when I set the delegate for one then call…
Andrea F
  • 733
  • 2
  • 9
  • 16
53
votes
16 answers

How to dismiss number pad keyboard by tapping anywhere

I'd like to know the simplest code to dismiss the number pad keyboard when tapping anywhere outside the number pad. It's a simple application to input a number inside a text field and then a user can dismiss the keyboard after the user finishes…
jsanmtosj
  • 563
  • 1
  • 7
  • 12
53
votes
4 answers

Swift UITextFieldShouldReturn Return Key Tap

(iOS8, Xcode6, Swift) Using Swift, how do I capture a tap on the "Return" button? The doc at the following link specifies using the textFieldShouldReturn method: // Swift @optional func textFieldShouldReturn(_ textField: UITextField!) ->…
kmiklas
  • 13,085
  • 22
  • 67
  • 103