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

Swift why strcmp of backspace returns -92?

I was tried to detecting backspace inside of UITextfieldDelegate. And found this answer. https://stackoverflow.com/a/49294870/911528 And It working correctly. But I don't know what's going on inside of this function. let char =…
AutumnSky
  • 394
  • 2
  • 14
8
votes
4 answers

iOS - validate user ip address during typing

So i want to validate the user ip during typing. In the VC i did the following : extension NetworkSettingsViewController: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { …
ironRoei
  • 2,049
  • 24
  • 45
8
votes
2 answers

Where to set UiTextField delegate method in custom UiView

Error occurs when I set UITextField delegate. My code is: import UIKit class UserAlertVC: UIView , UITextFieldDelegate { /* // Only override draw() if you perform custom drawing. // An empty implementation adversely affects performance during…
Gaurav
  • 334
  • 6
  • 28
8
votes
2 answers

How do I set the delegate for a text field in the interface builder to "files owner"?

I am trying to implement the : - (BOOL) textFieldShouldReturn:(UITextField *)textField method. For some reason it is not being called. I have set the text field to first responder in the code. I understand I also need to set the delegate for the…
Kex
  • 8,023
  • 9
  • 56
  • 129
8
votes
3 answers

Warning about assigning to id when I'm conforming to the protocol

My view controller is conforming to UITextFieldDelegate, yet when I try and set the .delegate field of my text field to self, I get the warning: "Assigning to 'id' from incompatible type 'AddReviewViewController *const __strong'" My header file…
Architekt
  • 2,141
  • 1
  • 22
  • 27
7
votes
1 answer

Can't type in uitextfield because of - [general] connection to daemon was invalidated

When I tap in UITextfield to edit it, the message "connection to daemon was invalidated" shows up and the keyboard on my iPhone doesn't show up. I am unable to edit any UITextfield at the moment because of such error. How can I fix this?
7
votes
8 answers

How to get UITableViewCell's index from its edited UITextField

I'm working on an iPhone based BI project. I have a UITextField in a UITextViewCell, the UITextFieldDelegate points to my UITableViewController, I haven't done any sub-classing for the UITextViewCell nor the UITextField. Now after the text field…
Zhao Xiang
  • 1,625
  • 2
  • 23
  • 40
7
votes
2 answers

UITextField to Input Money Amount

I am developing a Point Of Sales app. So I would like to Let's say User input 100000 but I want it to automatically show up 100,000. and 1000000 become 1,000,000 The second problem is that, I don't want user to be able to input . themselves. …
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
7
votes
4 answers

textFieldShouldEndEditing called multiple times

I am working on a view that has multiple UITextField objects. My view controller serves as the UITextFieldDelegate, and I've implemented the (BOOL)textFieldShouldEndEditing:(UITextField *)textField method to save and validate the record being…
7
votes
2 answers

UIAlertController's textfield delegate does not get called

I have added a UITextField to UIAlertController, but shouldChangeCharactersInRange will get not fired. Why? I set the delegate. let alertController = UIAlertController(title: "", message: "xxx", preferredStyle:…
János
  • 32,867
  • 38
  • 193
  • 353
7
votes
3 answers

How do I identify which textField triggered textFieldDidEndEditing on dynamically created UITableCell containing 2 uiTextFields?

I am on iOS 6 xcode 4.6.2 using storyboards. I am using a dynamic UITableView which consists of a number of cells each of which have two UITextFields on them. The two fields are defined in a custom cell as @property (strong, nonatomic) IBOutlet…
SimonTheDiver
  • 1,158
  • 1
  • 11
  • 24
7
votes
5 answers

textFieldDidBeginEditing is called prematurely

I have an application in which I have to scroll up in case of the keyboard showing. to get the keyboard size, I'm registering the UIKeyboardWillShowNotification event like so: [[NSNotificationCenter defaultCenter] addObserver:self …
donald
  • 489
  • 5
  • 13
6
votes
3 answers

How can I use Combine to track UITextField changes in a UIViewRepresentable class?

I have created a custom text field and I'd like to take advantage of Combine. In order to be notified whenever text changes in my text field, I currently use a custom modifier. It works well, but I want this code could inside my CustomTextField…
LondonGuy
  • 10,778
  • 11
  • 79
  • 151
6
votes
8 answers

Issue in `becomeFirstResponder()` in swift

I have six textfields. Now if all my textfield are filled and tap on any textfield the it should always put focus on sixth textfield & show the keyboard. I have tried below code but it does not show keyboard and only put focus when I tap on sixth…
TechChain
  • 8,404
  • 29
  • 103
  • 228
6
votes
5 answers

Disable copy, paste in UITextfield is not working in iOS 9.x

I created a text field in one class BBCustomUtility.h,.m class files and then +(UITextField*)createTextField: (CGRect)rect image:(NSString*)imageName tag:(int)tag secureText:(BOOL)entry placeh:(NSString*)placeholder { UITextField…
1 2
3
38 39