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
21
votes
2 answers

swift 2.0 - UITextFieldDelegate protocol extension not working

I'm trying to add a default behavior on some UITextFieldDelegate's methods using protocol extensions like so : extension ViewController: UITextFieldDelegate { // Works if I uncommented this so I know delegates are properly set // func…
Yaman
  • 3,949
  • 4
  • 38
  • 60
20
votes
2 answers

Action of the "Go" button of the ios keyboard

How do I bind an action to the Go button of the keyboard in iOS ?
Alexis
  • 16,629
  • 17
  • 62
  • 107
17
votes
13 answers

How to move cursor from one text field to another automatically in swift ios programmatically?

func textFieldDidBeginEditing(textField: UITextField) { scrlView.setContentOffset(CGPointMake(0, textField.frame.origin.y-70), animated: true) if(textField == firstDigit){ textField.becomeFirstResponder() …
Rakesh Mohan
  • 601
  • 2
  • 11
  • 23
16
votes
7 answers

iOS 6 UITextField Secure - How to detect backspace clearing all characters?

In iOS 6 if you type text into a secure text field, change to another text field, then come back to the secure text field and hit backspace, all of the characters are removed. I am fine with this happening, however, I am trying to enable/disable a…
crizzwald
  • 1,037
  • 2
  • 14
  • 30
15
votes
1 answer

iOS - Detect backspace in keyboard when UITextField is empty

Possible Duplicate: Detect backspace in UITextField I want to detect when backspace is pressed on the keyboard, even when a UITextField is empty. I tried to use ShouldChangeCharachtersInRange, but it does not get called when the backspace is…
Blondy314
  • 751
  • 9
  • 24
14
votes
3 answers

Properly Subclassing UITextField in swift

So i have these textfields that i realised that they all have same properties, so i created new class called "UserInputs" and extended from UITextField, everything works properly except one thing, UITextFieldDelegate functions doesn't work, i mean…
nikagar4
  • 830
  • 4
  • 11
  • 23
14
votes
5 answers

Change custom text field background color and text color IOS Swift

I'm using following custom text field class to change appearance of the text field. Now I need to change text field's background color, text color and place holder color, when user start editing and end editing the text field. How to do it, using…
Arvin Jayanake
  • 1,475
  • 3
  • 14
  • 26
14
votes
6 answers

Why is textFieldDidEndEditing: not being called?

I've got a UITextField, and when text gets entered into that, I want to obtain the doubleValue from the text field and perform some computations and display them in a UITableView. The delegate for the UITextField adopts the UITextFieldDelegate…
Chris Cleeland
  • 4,760
  • 3
  • 26
  • 28
13
votes
7 answers

Enabling done button after inserting one char in a textfield: textFieldDidEndEditing: or textFieldShouldBeginEditing: or?

I would like to enable the done button on the navbar (in a modal view) when the user writes at least a char in a uitextfield. I tried: textFieldDidEndEditing: enables the button when the previous uitextfield resigns first responder (so with the…
Sefran2
  • 3,578
  • 13
  • 71
  • 106
12
votes
3 answers

UITextField delegate jumping to 100% CPU usage and crashing upon using keyboard shortcut

So, I have a UITextField subclass which is it's own Delegate and is crashing when keyboard shortcuts are used. It maxes out on CPU and doesn't give an error. Without assigning itself as it's Delegate, it works without problem. When it is assigned as…
Andrew
  • 7,693
  • 11
  • 43
  • 81
11
votes
5 answers

How can I edit a UILabel upon touching it in Swift?

I want to know how to edit the label of text while the app is running. Example: there will be label called "Tap to Change text." When the user clicks it, it will be editable and the user can input text and enter. Then it will change to new text. I…
Im Batman
  • 1,842
  • 1
  • 31
  • 48
10
votes
1 answer

TextField becomeFirstResponder Issue for tab key(Keyboard) action

I have a view in XIB where i used several text fields in it. Let say the first text field becomes first responder as soon as the view gets loaded in the window. If i press tab key in my machine's keyboard to navigate to next text field ;apart from…
Balaji
  • 261
  • 6
  • 12
10
votes
5 answers

UITextFieldDelegate vs UITextField control events

If I want to handle changes to a UITextField, such as the user typing in it; it seems like this can be done either by assigning a delegate to that text field, and then having the delegate implement shouldChangeCharactersInRange, or by adding a…
GendoIkari
  • 11,734
  • 6
  • 62
  • 104
10
votes
4 answers

Trying to bold titleLabel of UIButton in response to delegate method being called in iOS

I am working on an application where I am calling the UITextFieldDelegate method: - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { } I am successfully calling it, and…
syedfa
  • 2,801
  • 1
  • 41
  • 74
9
votes
3 answers

is it possible to know if user is typing or deleting characters in a textfield?

I am using the text field delegate method "shouldChangeCharactersInRange" and I wanted to know if there is any way to tell if user is deleting characters or typing characters? Anyone know? thanks.
serge2487
  • 441
  • 2
  • 9
  • 23
1
2
3
38 39