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

Why does returning false in shouldChangeCharactersIn override old text in UITextField?

Problem Code public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { return false } TextField Creation @discardableResult fileprivate func otpTextField() ->…
badhanganesh
  • 3,427
  • 3
  • 18
  • 39
1
vote
1 answer

RxSwift Control Event with UITextFieldDelegate

I am using RxSwift for a project. I am using the control events to handle the textfield events such as follows. textField.rx.controlEvent([.editingDidEndOnExit]).subscribe { _ in }.disposed(by: disposeBag) Now I need to handle a delegate…
user4595813
1
vote
1 answer

Use core data index to fetch a specific item from core data

My swift code below when loaded places 3 items in the core data entity named "UserName". When the user enters a number into textfield enterT I want the label labelName to display it. So when the user enters 1 the label should display jessica biel…
user12655184
1
vote
0 answers

SwiftUI - Embedded UITextField invokes the shouldChangeCharacters delegate method for suggested text

I'm using UIViewRepresentable to wrap a UITextField in order to create a TextField view for SwiftUI which is more fully featured than the currently built-in one. The Coordinator class is of course the delegate of the UITextField. The delegate method…
1
vote
0 answers

How to create a custom UITextField prepackaged with its own formatting behavior?

I am trying to make a reusable textfield that will format its contents to be in a currency format without relying on a containing viewcontroller to implement this behavior for it. Right now the viewcontroller that the textfield is in is…
1
vote
1 answer

How to change UITextField when edited

When my UITextField is pressed and type commences, my UITextField is covered up. Is there a way to move it up or move the keyboard? If so, what function would I do that in?
Blane Townsend
  • 2,888
  • 5
  • 41
  • 55
1
vote
2 answers

Delegate methods not calling in UITextField custom subclass

I am creating a custom subclass from UITextField class. I want to apply something while textfield is focused. But in my custom class my delegate methods are not calling. I have create a subclass that extends UITextField class and make some…
1
vote
1 answer

After deleteRows used, becomeFirstResponer() doesn't give focus to textField

After any row is deleted by deleteRows(at:with:) from my Table View, I cannot get textfield in a reusable custom cell to get focus by becomeFirstResponder() (which is called after insertRows(at:with:) is called). becomeFirstResponder() is always…
1
vote
1 answer

Auto shift keyboard curser for OTP in objective C

I am trying to implement an OTP system in iOS. After getiing OTP (One Time Password) I am trying to change the cursor of keyboard but the cursor is shifting after typing in keyboard twice. For the first textfield it is working fine but while trying…
1
vote
3 answers

How to have a firstname validation in iOS swift4?

I have a first name validation to be done in swift4 which is in a UITextField. The thing is that: The Firstname should start with a letter and end with a letter, No trailing and leading whitespace. It can have spaces between them, can contain…
1
vote
0 answers

Which delegate is called at the touch of down arrow on the keyboard?

I want to know which delegate is called on click of the down arrow on the keyboard. I was expecting the cursor to move to the securityAnswer field after the securityQuestion field. But instead it skips one textfield and goes to the third one, i.e…
Ghazalah
  • 233
  • 2
  • 14
1
vote
2 answers

checks for which UITextField will be triggered (textFieldShouldBeginEditing)

I have been trying to implement the checks for which UITextField will be triggered. Here are the results of my findings for first two text fields only. This gives me two errors that says "sender undeclared"... Where am I doing wrong? Thanks in…
erguvani
  • 81
  • 1
  • 3
  • 7
1
vote
7 answers

How to prevent users from entering '#' and empty space(' ') in UITextfield - swift?

I am trying to prevent users from entering the characters '#' and empty spaces (' '). I have got as far as below (see code below) but not sure how to complete the rest ... class CreateTags: UIViewController, UITextFieldDelegate { /*** OUTLETS…
dean
  • 321
  • 3
  • 17
1
vote
1 answer

UITextField not working with add constraints programmatically

Here is my code , I am adding UITextfield programtically in scrollview. But UITextField is unable to open keyboard. It looks like UITextField is not enabling even added user interaction enabled true. I only use the constraints, no storyboard, no…
1
vote
3 answers

How to clear UITextFields in Swift?

I created multiple text fields programatically. Their input is being read and after the answer is checked a new question is being posed to the user. But I don't seem to be able to clear the text fields, the previous input is still there. I tried…
Emile
  • 41
  • 1
  • 9