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
68
votes
18 answers

Uppercase characters in UItextfield

I have a question about iOS UIKeyboard. I have a UITextField and I would to have the keyboard with only uppercase characters. I use a storyboard and I tried to set the Cpitalization as "All characters" to UITextField properties. But this not solve…
Safari
  • 11,437
  • 24
  • 91
  • 191
68
votes
9 answers

Add image to UITextField in Xcode?

I need to implement the concept of dropdown in Xcode. For that purpose, I'm using a UIPickerview. This pickerView loads when a textfield is tapped (on textFieldDidBeginEditing:)event. Question: Is there a way, that I can add a image to TextField?…
Honey
  • 2,840
  • 11
  • 37
  • 71
67
votes
11 answers

Disable UIScrollView scrolling when UITextField becomes first responder

When a UITextField embedded in a UIScrollView becomes the first responder (for example, by the user typing in some character), the UIScrollView scrolls to that Field automatically. Is there any way to disable that? Duplicate rdar://16538222
Rabih
  • 671
  • 1
  • 5
  • 3
67
votes
11 answers

Set UITextField Maximum Length

Is there any way to set the maximum length on a UITextField? Something like the MAXLENGTH attribute in HTML input fields.
EldenChris
  • 1,059
  • 1
  • 10
  • 16
67
votes
14 answers

Changing UITextField Placeholder font

I'm changing the placeholder text color with the following code, but when I try to add NSFontAttribute I get the compiler error "too many arguments to method call, expect 2 have 3" UIColor *color = [UIColor blackColor]; …
Bob Yousuk
  • 1,155
  • 3
  • 10
  • 16
66
votes
9 answers

How to input currency format on a text field (from right to left) using Swift?

I have a number let’s say 0.00. When the user taps 1. We should have 0.01 When the user taps 2. We should display 0.12 When the user taps 3. We should display 1.23 When the user taps 4. We should display 12.34 How can I do that with Swift?
Bolo
  • 2,668
  • 4
  • 27
  • 34
66
votes
14 answers

How to disable pasting in a TextField in Swift?

I've got a TextField with a numberPad and the function runs only if it contains numbers. The user will crash the app if they paste letters in the TextField and click OK. How can I disable pasting in the TextField?
Eliko
  • 851
  • 2
  • 7
  • 9
65
votes
6 answers

How to make the text of UITextField to appear with First letter Capital in iPhone

I have a text box and I am only interested in capitalizing the first letter, So how to do that in iPhone UITextField.
rkb
  • 10,933
  • 22
  • 76
  • 103
64
votes
7 answers

Unable to add UITextField to UIAlertView on iOS7...works in iOS 6

The code below works on iOS6 (and before) but the UITextField does not display in iOS7...any ideas on how to get a UITextField to display in an UIAlterView in iOS7? UIAlertView* dialog = [[UIAlertView alloc] init]; [dialog setDelegate:self]; [dialog…
iTrout
  • 1,454
  • 2
  • 12
  • 21
63
votes
19 answers

How to dismiss keyboard when touching anywhere outside UITextField (in swift)?

I'm working on a project that have a UIViewController, on the view controller there is a UIScrollView and a UITextField on the scrollview. like this: I'm trying to dismiss the keyboard and hide it after typing some text in the textfield and tap…
White Hat
  • 681
  • 1
  • 6
  • 15
62
votes
10 answers

Disable UITextField keyboard?

I put a numeric keypad in my app for inputing numbers into a text view, but in order to input numbers I have to click on the text view. Once I do so, the regular keyboard comes up, which I don't want. How can I disable the keyboard altogether? Any…
michael
  • 621
  • 1
  • 5
  • 3
61
votes
7 answers

How set swift 3 UITextField border color?

Hello i have working no error codes for UITextfield border color change but when using it in Swift 3 dont change textfield border color and dont gives error. I need your help my codes under below. @IBOutlet weak var email: UITextField! @IBOutlet…
SwiftDeveloper
  • 7,244
  • 14
  • 56
  • 85
61
votes
4 answers

How to open the keyboard automatically on UITextField?

I have a very simple table and when tocuh a cell it opens a new view with one UITextfield. All I want is that the keyboard will automatically opens, without the user have to touch the UITextfield. Its all done in Interface Builder, so I am not sure…
eemceebee
  • 2,656
  • 9
  • 39
  • 49
61
votes
7 answers

iPhone how to get UITextField's text while typing?

I'm trying to show changes made to a UITextField on a separate UILabel. Is there a way to capture full text of the UITextField after each character the user types in? Currently I'm using this method, but it does not capture the last character that…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
60
votes
4 answers

How to add textField in UIAlertController?

I want to realize a function about changing password. It requires users to input their previous password in an alert dialog. I want to click the button "Confirm the modification" then jump to the other view controller for changing password. I have…
Juice007
  • 1,054
  • 1
  • 9
  • 14