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

How to make UITextField select all first and then edit programatically?

I have a UITextField. On first click I want to select all the text programatically. So I called [textField selectAll:nil] in textFieldDidBeginEditing: delegate method. When I make a next click I want it to become normal editing mode. How to…
Sheik_101
  • 770
  • 1
  • 8
  • 24
1
vote
1 answer

How to use drop down menu in uitextfield in ios?

I am trying to implement a drop down menu in text field in ios. For this i have been trying to implement this solution for text field https://github.com/romaonthego/REMenu Above menu bar works great for nav bar but unable to add it on text…
warzone_fz
  • 472
  • 1
  • 9
  • 24
1
vote
1 answer

Detect textfield overflowing

I'd like to be able to detect when a UITextfield overflows it bounds. I want to detect Horizontal overflow (since there is only 1 line). I was thinking about counting the amount of characters and multiplying that with a default value for the letter…
milo526
  • 5,012
  • 5
  • 41
  • 60
1
vote
0 answers

Swift 2.0 : Count is unavailable access the count property on the collection

I get error when I set a limit to the textfield to 300 class ViewController: UIViewController, UITextFieldDelegate { func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool…
marrioa
  • 1,265
  • 4
  • 14
  • 29
1
vote
1 answer

inputAccessoryView Not calling when keyboard appearing

I have added InputAccessoryViewto my keyboard disappear. It woks fine. But in some ViewController its not appearing. Even that method doesnt call. I have a button. When I click on that my text field become first responder automatically. (cursor…
IRD
  • 1,127
  • 2
  • 8
  • 15
1
vote
0 answers

iOS: TPKeyboardAvoiding - Cursor does not advance to the next parallel-height UITextField

I am using TPKeyboardAvoiding in my current app project. I have this peculiar problem where I have 3 text fields on the same height level (y-position). When I click "Next", the cursor correctly jumps from the 1st text field to the 2nd. But if I…
Marcus
  • 548
  • 1
  • 5
  • 13
1
vote
3 answers

Strip spaces when pasting into UITextField?

If I copy abc 123, and paste it into my UITextField, I’d like abc123 to be entered. I’m trying to use shouldChangeCharactersInRange:replacementString from UITextFieldDelegate, but changing the replacementString argument doesn’t change what actually…
Luke
  • 9,512
  • 15
  • 82
  • 146
1
vote
1 answer

UITextFieldDelegate works on iOS 8 but not iOS 7

I have a UIViewController that has a UITextField in it, and conforms to the UITextFieldDelegate protocol. When I first built the app iOS 7 was the latest iOS and when I selected the text field, the keypad would appear, as expected. Along comes…
zeeple
  • 5,509
  • 12
  • 43
  • 71
1
vote
3 answers

How do I restrict UITextField to English only? (Stopping Chinese pinyin input)

I am building an app for release in Taiwan so it will be mostly in Chinese however the usernames must be English. I'm not sure how to stop Chinese characters from being input. So far I have restricted the length of the username to 12 characters and…
Kex
  • 8,023
  • 9
  • 56
  • 129
1
vote
3 answers

Require a UITextField to take 5 digits

I have a UITextField set up to show a number pad. How do I require the user to enter exactly 5 digits? I poked around and saw I should use shouldChangeCharactersInRange but I'm not quite understanding how to implement that.
May Yang
  • 523
  • 1
  • 5
  • 18
1
vote
2 answers

UITextField loses settings

I am creating a screen "X". Within this screen I'm creating a UITextField and after the change of "TextColor" and "Font" this respective UITextField. However, when I go to the screen "Y" and return to the screen "X" using a modal segue UITextField…
1
vote
1 answer

Is there any way to make UITextFieldDelegate more dynamic in swift?

I nearly have a UITextFieldDelegate in a UIViewController,and I make import UIKit class testViewController: UIViewController,UITextFieldDelegate{ @IBOutlet weak var textName: UITextField! override func viewDidLoad(){ …
TzeChung
  • 13
  • 3
1
vote
2 answers

Trigger textFieldShouldClear programmatically

If I understand correctly, the UITextFieldDelegate method textFieldShouldClear gets triggered once the user taps on the clear button/icon provided with and enabled for a UITextField. But I need to clear the UITextField programmatically, which, in…
artooras
  • 6,315
  • 9
  • 45
  • 78
1
vote
3 answers

setting Delegates on destination viewController

This is puzzling me. The context The original tutorial I'm following. Where the segue is added to the Main View via a custom segue: - (void) perform { MainViewController *source = (MainViewController *)self.sourceViewController; …
carlodurso
  • 2,886
  • 4
  • 24
  • 37
1
vote
5 answers

Set max length of UITextField AND convert to uppercase?

I have a Client Details screen with many UITextField. I need to limit the postcodeField to a maximum of 7 characters and convert to uppercase automatically. I already have code to convert the text to uppercase, but it seems I cannot do anything else…
rosshump
  • 370
  • 1
  • 4
  • 21