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

formatting textfield while user is typing

I would like the user to type an amount in a textfield and I want the value to be formatted as it is being typed. Which means as the user types in the 4th digit, a comma appears at the appropriate spot denoting the thousands. example: 3,450 Right…
1
vote
1 answer

UITextField rightView image and button?

I'm having 2 problems with UITextView. I have a UIViewController that has 5 UITextField. UITextField1 and UITextField2 are always visible and cannot be hidden by the user. If the user taps on a button, it adds (isHidden property is set to false) up…
Dani
  • 3,427
  • 3
  • 28
  • 54
1
vote
3 answers

UIAlertController with textfield: how dismiss keyboard works?

In my UIViewController subclass I created a UIAlertController with a UITextField: class MyViewController: UIViewController { ... let alertController = UIAlertController(title: "a title", message: "", preferredStyle: .alert) let okAction =…
Giorgio
  • 1,973
  • 4
  • 36
  • 51
1
vote
1 answer

Swift 4 how to know delete key is pressed when UITextField becomes first responder?

I've searched for the answer, it's all about using shouldChangeCharactersInRange function of UITextFieldDelegate. It works for most cases. But what if UITextField is already empty,shouldChangeCharactersInRange method is not called any more when…
yancaico
  • 1,145
  • 11
  • 21
1
vote
1 answer

UITextfield delegate method in mvvm

I need to search the tableview in mvvm . my viewmodel:- function for search:- func search(searchText :String?) { filteredListArray = datasourceModel.dataListArray?.filter{($0.restaurantname?.range(of: searchText!, options:…
1
vote
1 answer

Initiate IBAction of a UIButton on Return key

I have a SignUp Form which includes a number of UITextfields and UIButton. I have set up UITextfield delegates so that the when user starts editing on a UITextfield and presses the return key it goes to the next UITextfield. DoB, ISD Code, Gender…
alpha47
  • 305
  • 3
  • 17
1
vote
1 answer

Objective C - UITextFieldTextDidChangeNotification not responding to correction selection

In my app, I have a simple textfield set up for the user's zip code while registering: I am listening for changes to the textfield as so: [self.zipCode addTarget:self action:@selector(textFieldDidChange:)…
Adam G
  • 1,188
  • 10
  • 24
1
vote
2 answers

Swift: Delegate of UITextField in UITableViewCell does not work

I'm trying to set the delegate of my titleTF to my UITableViewCell or my UITableView. This is how I set up the textField inside my UITableViewCell class. class AddAppointmentTableViewCell: UITableViewCell, UITextFieldDelegate, UITextViewDelegate…
l30c0d35
  • 777
  • 1
  • 8
  • 32
1
vote
1 answer

textFieldShouldReturn not being called after upgrade in Swift 4

I have a view controller with a few UITextFields on it. When a UITextField has focus, if I tap on the Return key on the keyboard, I go to the next UITextField. If the next UITextField is below the keyboard, I move the view up. All was fine until…
daydr3am3r
  • 920
  • 4
  • 12
  • 31
1
vote
2 answers

Can we call delegate in an extension of UITextField

I am not able to find any way to call the delegate in the below code and without delegate the textFieldDidBeginEditing method cant be called import UIKit class ModifiedTextField: UITextField { } extension UITextField: UITextFieldDelegate{ func…
Abhinav Jha
  • 295
  • 1
  • 17
1
vote
1 answer

How to change text of return key and make a Custom UIReturnKeyType

We have a number of types available for keyboard return buttons in swift 4 like done, yahoo etc. I want the return key to be Add how can I do that? Is there a way to define a custom UIReturnKeyType type?
Chaudhry Talha
  • 7,231
  • 11
  • 67
  • 116
1
vote
2 answers

UITextfield with multiple delegates

I am using JJMaterialTextField custom UITextField class. It has some delegates for animation placeholder etc..I want to use some other delegates too for UIViewController which uses that class. If I write down delegate.self for JJMaterialTextField…
1
vote
3 answers

Capture delegate methods from UITextField subclass without being the delegate

I have a UITextField subclass. I needed to know when text did change and I was able to get that with NotificationCenter and observing .UITextFieldTextDidChange but now I need to know when the user tap return button. The only solution that I can…
iOSGeek
  • 5,115
  • 9
  • 46
  • 74
1
vote
1 answer

Swift Scroll to UITextField via UiscrollView only acts first time bug

im posting my full code here. the problem is when initially loading the app and the viewcontroller. it fully works. tap on the two textfields and the scrollview pushes up and keyboard is below the current textfield. but then if tapping out of the…
1
vote
1 answer

Password AutoFill in iOS 11 ignores NO returned from textField:shouldChangeCharactersInRange:replacementString:

My iOS app has username & password text fields. The username has specific limitations which are ensured by textField:shouldChangeCharactersInRange:replacementString: which returns NO for invalid resulting strings. In iOS 11 I observe an issue when…
jesse
  • 650
  • 5
  • 19