uitextfielddelegate

Why is textFieldDidEndEditing: not being called?

有些话、适合烂在心里 提交于 2019-12-01 15:16:22
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 protocol, and implements both textFieldShouldReturn: and textFieldDidEndEditing: methods. textFieldShouldReturn: resigns first responder status which, according to docs should also trigger textFieldDidEndEditing:, but I never see textFieldDidEndEditing: called. - (BOOL)textFieldShouldReturn:(UITextField*)theTextField { if (theTextField == thresholdValue)

Why is textFieldDidEndEditing: not being called?

六月ゝ 毕业季﹏ 提交于 2019-12-01 14:09:17
问题 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 protocol, and implements both textFieldShouldReturn: and textFieldDidEndEditing: methods. textFieldShouldReturn: resigns first responder status which, according to docs should also trigger textFieldDidEndEditing:, but I never see textFieldDidEndEditing:

Action when the small cross button of UITextField is pressed

依然范特西╮ 提交于 2019-12-01 08:52:25
I can add a small cross button that is used to clear all the text in a single click in a UITextField with the following code. textField.clearButtonMode = UITextFieldViewModeWhileEditing; I also implemented UITextFieldDelegate . I want to activate/deactivate the right bar button of the UINavigationBar according to the changes in my UITextField . The rule is simple: if the text field has at least one character, just enable the button, else disable it. I implemented the UITextField 's delegate method textField:shouldChangeCharactersInRange: to constantly check the requirement and update the

Action when the small cross button of UITextField is pressed

♀尐吖头ヾ 提交于 2019-12-01 07:06:28
问题 I can add a small cross button that is used to clear all the text in a single click in a UITextField with the following code. textField.clearButtonMode = UITextFieldViewModeWhileEditing; I also implemented UITextFieldDelegate . I want to activate/deactivate the right bar button of the UINavigationBar according to the changes in my UITextField . The rule is simple: if the text field has at least one character, just enable the button, else disable it. I implemented the UITextField 's delegate

Change custom text field background color and text color IOS Swift

半腔热情 提交于 2019-11-30 18:27:44
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 this class. import Foundation import UIKit class CustomTextField: UITextField{ required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) //Border self.layer.cornerRadius = 15.0; self.layer.borderWidth = 1.5 self.layer.borderColor = UIColor.whiteColor().CGColor //Background self.backgroundColor = UIColor(white: 1, alpha: 0.0) //Text self

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

独自空忆成欢 提交于 2019-11-30 12:14:28
问题 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 zero chars in the current uitextfield). textFieldShouldBeginEditing: is called when the textfield becomes the first responder. Is there another way to do this? [EDIT] The solution could be -(BOOL)textField:(UITextField *)textField

Action of the “Go” button of the ios keyboard

故事扮演 提交于 2019-11-30 11:44:34
问题 How do I bind an action to the Go button of the keyboard in iOS ? 回答1: Objective-C Assuming you're using a UITextField, you could use the <UITextFieldDelegate> method textFieldShouldReturn . - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; // Dismiss the keyboard. // Execute any additional code return YES; } Don't forget to assign the class you put this code in as the text field's delegate. self.someTextField.delegate = self; Or if you'd prefer to use

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

坚强是说给别人听的谎言 提交于 2019-11-30 11:25:50
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 button based on if this secure text field has characters in it or not. I know how to determine what characters are in the fields and if a backspace is hit but I am having trouble determining how to detect if clearing of all the characters is happening. This is the delegate method I'm using to get the new text of a field, but, I can't seem to figure

How can I show a UIDatePicker inside a Popover on iPad using StoryBoard?

扶醉桌前 提交于 2019-11-30 10:20:38
I have achieved to show the datepicker inside the popover, doing it programmatically as it is shown in UIDatePicker in UIPopover . But I have been trying to do it in interface Builder, I already made a View Controller named DatePickerViewController.m with a DatePicker in it and its corresponding IBoulet #import <UIKit/UIKit.h> @interface DatePickerViewController : UIViewController @property (strong, nonatomic) IBOutlet UIDatePicker *birthdayDatePicker; @end Then I need this to be shown in a popover when the Birthday text field is being edited. so I use the following code - (BOOL

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

有些话、适合烂在心里 提交于 2019-11-30 02:12:16
func textFieldDidBeginEditing(textField: UITextField) { scrlView.setContentOffset(CGPointMake(0, textField.frame.origin.y-70), animated: true) if(textField == firstDigit){ textField.becomeFirstResponder() secondDigit.resignFirstResponder() } else if(textField == secondDigit){ textField.becomeFirstResponder() thirdDigit.resignFirstResponder() } else if(textField == thirdDigit){ //textField.becomeFirstResponder() fourthDigit.becomeFirstResponder() } I am using four textfields for OTP entry in which only one number can be entered at a time. After entering the number I need to move the cursor