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
1
vote
1 answer

Deleting Emoji Bug

I followed this link Find out if Character in String is emoji? to try to limit the amount of characters my text field even with emojis. According to this link, I have to count emojis based on their glyphs and everything is working except for one…
Mochi
  • 1,059
  • 11
  • 26
1
vote
2 answers

how can I add a permanent character at the beginning of an input field in uiAlert Popup?

When user presses a button in my app I show him the alert view with an input text field there. I use the following code for that: func addTapped(sender: UIBarButtonItem) { let alertController = UIAlertController(title: "", message: "Write a…
user3766930
  • 5,629
  • 10
  • 51
  • 104
1
vote
0 answers

Why is editingChanged not a function in UITextFieldDelegate?

In my project, I needed to toggle a save button whenever the text in 2 of my textFields changed, so I instinctively looked into the methods of UITextFieldDelegate, since I was already using it. I learned that there is no method for doing this, the…
Hayden Holligan
  • 1,822
  • 2
  • 19
  • 26
1
vote
1 answer

Accounting for backspace in UITextField validation using shouldChangeCharactersInRange

I'm attempting to put validation in a textField to ensure it only contains letters. It works until I press backspace. As a workaround, I tried to create a NSMutableCharacterSet and use formUnionWithCharacterSet to add…
Adrian
  • 16,233
  • 18
  • 112
  • 180
1
vote
2 answers

How to detect if a textfield is empty in swift?

Hello despite the question name, this question requests a bit more insight. I want to know how to check if a textfield is empty but it must be able to detect this if contained text previously. Here is my current code func textField(textField:…
T Race
  • 115
  • 1
  • 3
  • 9
1
vote
2 answers

Overriding UITextField delegate methods

I'm converting this Objective-C project (TSCurrencyTextField) to Swift. It's a UITextField subclass formatted to accept currency values. This is the .m file I'm trying to convert. In it, the UITextField's method shouldChangeCharactersInRange is…
Isuru
  • 30,617
  • 60
  • 187
  • 303
1
vote
0 answers

Extension of UIViewController to implement all UITextField Dismiss and control features

In Android Keyboard controls are in built, But Ios Swift, really dono why we need so much to code. I wannu implement following all together : * Dismiss keyboard on tapping elsewhere * Move View abv wen TextField is behind keyboard * Implement Next…
Sujay U N
  • 4,974
  • 11
  • 52
  • 88
1
vote
1 answer

iOS: Most stable way to handle text field/view interactions and keyboard movements?

I have an app that has a mix of text fields and text views, and people interact with them in various ways. Some switch from entry field to entry field, some type into the field and hit "done," etc. Has anyone found a way they particularly like to…
Taylor Nelms
  • 384
  • 2
  • 16
1
vote
2 answers

Adding Prefixed Character to UITextField

I have a UITextField for formatting phone numbers. I am trying to add a "+" sign prefix as the first character, that can't be removed. Formatting & checks are working fine, but having a prefix doesn't seem to work.. In the beginning, it doesn't…
senty
  • 12,385
  • 28
  • 130
  • 260
1
vote
2 answers

Put range and avoid special character in a textfield

I am working on iOS. I have a text field on which it should have range to 7 digits, and avoid special characters also. I only want to enter number from 0-9999999. Please help - (BOOL)textField:(UITextField *)textField…
Asad Ali
  • 55
  • 6
1
vote
3 answers

Dismiss Keyboard in UITextField

Anyone has a Solution for my Problem? I have an UITextField and want to Dismiss the Keyboard after pressing on Return. I added the UITextFieldDelegate and want to set the Delegate on my TextField, but the error remains...
hannes
  • 519
  • 4
  • 11
  • 23
1
vote
0 answers

TextField delegate in separate class not working

So I'm trying to separate out my delegate into a separate class instead of housing it in my cell class. Here's how I declare and initialize the delegate: class RegistrationTableViewController: BaseTableViewController, UITextFieldDelegate { var…
Bill L
  • 2,576
  • 4
  • 28
  • 55
1
vote
1 answer

UITextField — observe changes during text Selection and cursor move

I am facing a problem regarding cursor move. I have applied below solution and it is not working: In ViewController.h file @interface ViewController : UIViewController @property (weak, nonatomic) IBOutlet UITextField…
Arup Sarker
  • 173
  • 1
  • 9
1
vote
2 answers

Set maximum length to dynamically added textfields

I have added textfields dynamically to scrollview as below:- for(int i = 0; i< responseBillPay.billerDetails.payeeFormat.count; i++) { UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, y, width, height)]; …
poojathorat
  • 1,200
  • 2
  • 9
  • 19
1
vote
1 answer

iOS 9 Swift 2.0 UITextFieldDidChange

I am having a problem using the textFieldDidChange or textFieldDidEndEditing method in a subclass of UITextField. I change the UITextField's text property in another source (object). Can this method be called?
Cody Weaver
  • 4,756
  • 11
  • 33
  • 51