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
3
votes
1 answer

selectedTextRange always returning nil

I have a subclass of UITextField like: @interface CustomTextField : UITextField -(NSRange) getSelection; @end @implementation CustomTextField -(NSRange) getSelection { UITextRange *selectedRange = [self selectedTextRange]; …
3
votes
3 answers

Best way to count length of UITextInput text value in Swift?

I have two UITextInput controls that I want to count the number of characters in. For context, I have two inputs: one for email address and one for password. I also have a “Login” button. The button is inactive by default, but as soon as at least…
Martin Bean
  • 38,379
  • 25
  • 128
  • 201
3
votes
1 answer

textFieldDidBeginEditing func is not being called when tapping on a text field

I have a project with three views that are all multiple textFields that call a UIPickerView when tapped. I have two of the views working just fine but when I started on the third one I cannot get the textFieldDidBeginEditing function to be called. I…
Greg
  • 427
  • 3
  • 7
  • 21
3
votes
1 answer

UITextField subclass - subscribing to events

I've created a subclass of UITextField which has its own visual style and functionality. The functionality is to restrict the user to decimal currency values (for example, 3.50), but that's not really relevant because I know the algorithm I have…
Ryan Bobrowski
  • 2,641
  • 3
  • 31
  • 52
3
votes
2 answers

Keyboard autocorrection height (with/without the autocorrection)

I get the keyboard height like this: - (void)keyboardNotification:(NSNotification*)notification { NSDictionary* keyboardInfo = [notification userInfo]; NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameEndUserInfoKey]; …
gran33
  • 12,421
  • 9
  • 48
  • 76
3
votes
1 answer

Making a UICollectioView scroll when text field is selected

I have a UICollectionView. On the inside of one of its items I have UITextField, the problem is: when the keyboard up the textfield is hidden by the keyboard and the user does not see what he is currently writing... I try the following…
3
votes
2 answers

UIKeyboardWillChangeFrameNotification called BEFORE textViewDidBeginEditing, but AFTER textFieldDidBeginEditing? Why?

I have the following observer in my ViewController. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil]; This view controller also conforms to…
chris P
  • 6,359
  • 11
  • 40
  • 84
3
votes
3 answers

Search bar at the top of a UIPickerView in Swift

So I have a textField, which when the user presses, it shows a UIPickerView, which is populated from an array. Is it possible for there to be search bar at the top of the pickerView, so the user can search for something in the pickerView? I've not…
Nick89
  • 2,948
  • 10
  • 31
  • 50
3
votes
4 answers

Converting fractions into decimals from UITextField in Swift

Is it possible to convert fractions that are entered into UITextField into decimals? So far, this is what I have tried. If I enter in 2/3 into my UITextField, I get 2.0 as my answer. @IBOutlet weak var answer: UITextField! var sAnswer =…
Eugene
  • 239
  • 2
  • 16
3
votes
7 answers

Validate against empty UITextField?

What is the value of a UITextField when it is empty? I can't seem to get this right. I've tried (where `phraseBox' it the name of the said UITextField if(phraseBox.text != @""){ and if(phraseBox.text != nil){ What am I missing?
Moshe
  • 57,511
  • 78
  • 272
  • 425
3
votes
3 answers

How to add line at the top of keyboard in ios?

I have a view in which I show Numeric Keyboard. My problem is that the keyboard is missing a top line. With a white background an unpleasant effect appears: How can I add a 1pt view at the top to simulate top line?
new2ios
  • 1,350
  • 2
  • 25
  • 56
3
votes
4 answers

Dismiss keyboard when tapping on an UITextField with custom inputView

I have three UITextFields UITextField1 <- shows keyboard UITextField2 <- shows keyboard UITextField3 <- shows custom inputView (pickerView) When finishing editing textField2, I click "next" on the keyboard, it hides the keyboard but the picker its…
spezzino
  • 664
  • 12
  • 21
3
votes
1 answer

Swift UITextField icon position

I'm trying to set the position of my custom UITextField icon. But when I change the imageView's frame's x and y values, it still places them top left. Here's the viewWillAppear method of my custom UITextField class: var imageView =…
Sean H
  • 1,045
  • 1
  • 14
  • 32
3
votes
3 answers

How can I enable the UITextField to have only one text/number and navigate through multiple `UITextField`s using Next / Done Button

I have to handle navigate through multiple UITextFields using (Next / Done Button) and now I have to allow only one text/number in each UITextField how could we do that in UITextField as shown in image below I have used following code recently and…
Nischal Hada
  • 3,230
  • 3
  • 27
  • 57
3
votes
0 answers

UIVisualEffectView as input view for textfield in Xcode

I want to program a custom view as the input view for a textfield. This custom keyboard is a UIVisualEffectView with a blur effect, but when the keyboard shows up, the background isn't transparent, it's opaque. When I add the keyboard as a subview…
Josef Büttgen
  • 131
  • 2
  • 12