Questions tagged [uitextfielddelegate]

The methods declared by the UITextFieldDelegate protocol allow the adopting delegate to respond to messages from the UITextField class.

The methods declared by the UITextFieldDelegate protocol allow the adopting delegate to respond to messages from the UITextField class. On UITextFieldDelegate, you can find the following methods:

Managing Editing

– textFieldShouldBeginEditing:

– textFieldDidBeginEditing:

– textFieldShouldEndEditing:

– textFieldDidEndEditing:

Editing the Text Field’s Text

– textField:shouldChangeCharactersInRange:replacementString:

– textFieldShouldClear:

– textFieldShouldReturn:

574 questions
2
votes
0 answers

UITextView text color changing after editing

So I have an issue where I've made a subclass of UITextView to change the various colors before and after focusing. I've found thought that after actually entering in text it pretty much disregards the text color I specified. My code looks like…
2
votes
3 answers

UITextfield inside UITableViewCells - dismiss keyboard

I have a couple of UITextfields in each table cell. By hitting the "Done" button or touching outside the keyboard, the keyboard should be dismissed. My problem: the textFieldShouldEndEditing method is only called when I tap another textfield and the…
Netzer
  • 227
  • 1
  • 3
  • 8
2
votes
1 answer

shouldChangeCharactersInRange multiple text fields gets frozen

Updated code bellow with solution. This works with as many fields you want. It also fixes the textfield frozen issue when the method returns false. The line bellow is what guides the method to return true after returns false. newString =…
GuiSoySauce
  • 1,763
  • 3
  • 24
  • 37
2
votes
2 answers

how can I make a particular textfield uneditable when using shouldChangeCharactersInRange function

I am working on my sign up page that has 4 text fields. One of the text fields works as Picker-view, when users tap on it a picker-view will pop up with options to choose from. The question is how can I make that particular textfield uneditable?…
user3700449
  • 91
  • 2
  • 10
2
votes
3 answers

Why range.length value changes for backspace in shouldChangeCharactersInRange delegate methos?

I'm trying to figure out this line which works pretty well for backspace after I restrict user up to 24 characters. But I don't know how it really works. I tried to figure out the value of range.length and it's set to 0 if I insert some characters.…
LC 웃
  • 18,888
  • 9
  • 57
  • 72
2
votes
1 answer

deleteBackward not getting called for custom UITextfield

I want to develop passcode like functionality in my app.For that i am using textfields.Entering passocode is done successfully.Now i want to implement clear passcode text entered on back button action of numberpad. Here is my code snippet of…
MURR
  • 91
  • 1
  • 4
2
votes
1 answer

As user types, format text field with NSNumberFormatter extension in Swift

I am working on a loan app, where I am struggling to figure out how to format the text fields as soon as the user types. It would be nice to see that because the outputs are calculated as soon as there is a digit in the textfield. In my…
2
votes
2 answers

UItextfield shouldChangeCharactersInRange method backSpace not working

I implement this code but backspace not working until i press delete button in UITextfield I want to do with Backspace delete. - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString…
user4303353
2
votes
4 answers

Disable UIButton w/ textFieldDidBeginEditing requires clicking off of UITextField to take effect

With the UITextFieldDelegate, I'm disabling my UIButton "btnSignup" based on whether 3 UITextFields contain information or not. Currently, it works appropriately minus the fact that for the UIButton to reactive (run through the if statement again),…
davidrayowens
  • 1,562
  • 2
  • 13
  • 23
2
votes
1 answer

Custom UITextField delegate set to self initiates infinite loop

I am writing iPhone App in which I need custom UITextField class. For my text fields I need indent, image inside before the text and max characters. For this reason I created custom class based on UITextField. All my text fields will be based on…
new2ios
  • 1,350
  • 2
  • 25
  • 56
2
votes
1 answer

How do I check UITextField values for specific types of characters e.g. Letters or Number?

What I want to do is set some boolean in the if statement below to true if anything other than letters, numbers, dashes and spaces is contained in the textField. Then for an email field check for a valid email. This is how I'm checking for length: …
LondonGuy
  • 10,778
  • 11
  • 79
  • 151
2
votes
1 answer

How do I centre UITextField cursor after user input consistently

I have a UITextField that I want to centre all content (text, cursor) at all times. Is this possible in iOS 7? My current initialisation of the view is shown below. self.textField = [[UITextField alloc] init]; self.textField.delegate =…
2
votes
1 answer

how to know if textfield value changd while data entered from a button ios

how can i know if a textfield value is changed while i'm entering data from some buttons rather than from keyboard .I have tried UITextfield delegate methods but it works only if i am tusing the keyboard.I am using different UIButtons to enter…
2
votes
1 answer

Correcting the text cursor in a UITextField when replacing its text

I am implementing shortcut substitution for text typed into a UITextField. For instance, if the text field already contains "a" and he types another "a" after it, I'd replace it with "ä". In another case, if he types "a", then "b", I'd replace it…
2
votes
3 answers

In iOS 7, setting delegate of UITextField inside UISearchBar seems to break both. How can I get both delegates to respond?

I have a search bar which filters contacts as the user types, but I also need to access the text field directly in case they type a name that is not in the address book. So, I need to have both UISearchBarDelegate and UITextFieldDelegate working at…