uitextfield

iOS 13: UITextField with LeftView spacing issue - Xcode 11

老子叫甜甜 提交于 2020-01-24 19:42:25
问题 iOS 12.0 with Xcode 10.0 iOS 13.0 with Xcode 11.0 I have taken custom LeftView with image and label for adding LeftView in UITextField. I have set all the needed constraints also but still I am facing issues of LeftView width spacing. In old Xcode and iOS it was working well but after new Xcode and iOS there is something wrong. 回答1: I had similar problem fixed by adding constraints. Make sure had set UIImageView and UILabel width constraints and margins with other views, like: H:|-0-[image(=

Show UITextField keyboard on firstResponder even when userInteractionEnabled = NO

主宰稳场 提交于 2020-01-24 08:49:46
问题 I have a UITextField that is first responder. I want to show keyboard when entering the view but I want to do that the user will not be able to edit it and the cursor will be hidden all time as well. When you click on a keyboard letter, it will be written in the UITextField, but the user will not be able to edit nothing there, even not to copy. Thanks! 回答1: Ok, per my comment, my solution is to have a surrogate UITextField that has its hidden property set to YES . What I do is add that hidden

IQKeyboardManager is not working in subviews

此生再无相见时 提交于 2020-01-24 06:27:15
问题 I have three UIView s in a single UIViewController . Each UIView contains a UITextField . But IQKeyboardManager is not showing next and previous arrows as every textfield is in a different view. Is there any solution for this? 回答1: You can make UITextFields/UITextViews container view as IQPreviousNextView. It is designed to handle the situation you are facing. You can find it's demo on repository demo project. 来源: https://stackoverflow.com/questions/37391882/iqkeyboardmanager-is-not-working

IQKeyboardManager is not working in subviews

…衆ロ難τιáo~ 提交于 2020-01-24 06:23:34
问题 I have three UIView s in a single UIViewController . Each UIView contains a UITextField . But IQKeyboardManager is not showing next and previous arrows as every textfield is in a different view. Is there any solution for this? 回答1: You can make UITextFields/UITextViews container view as IQPreviousNextView. It is designed to handle the situation you are facing. You can find it's demo on repository demo project. 来源: https://stackoverflow.com/questions/37391882/iqkeyboardmanager-is-not-working

How could I enable / disable keyboard Return Key manually in Swift?

旧街凉风 提交于 2020-01-23 06:36:27
问题 This question is not duplicated from these: How to disable/enable the return key in a UITextField? How to enable or disable the keyboard return key Enable and Disable Keyboard return key on demand in iOS I have two TextFields . @IBOutlet weak var textField1: UITextField! @IBOutlet weak var textField2: UITextField! textField1 has the Next button like the Return Key; textField2 has the Go button like the Return Key; textField1 textField2 I would like to enable the Go button of the second

Validate Textfield after each character entered

安稳与你 提交于 2020-01-23 03:59:13
问题 I have searched for an answer but cant find an answer related to this. I am trying to validate every input into a textfield but not sure how to go about it, the idea is to check a username exist on a server so I would assume I need to post to the server each time something is entered and if success do whatever. Could someone please advise I would be grateful. 回答1: You can use addTarget:action:forControlEvents: with UIControlEventValueChanged (e.g: [textfield addTarget:self action:@selector

Become first responder without animation

拟墨画扇 提交于 2020-01-22 13:44:09
问题 Is there a way for a UITextField to become first responder without the animation of the keyboard? That is, make it such that the keyboard just appears? Basically, I'm pushing a second UIViewController over the UIViewController that has the UITextField , and when that second view controller gets popped off the stack, I want the UITextField to immediately have first responder status so that when the second view controller gets popped, the user never notices the text field wasn't first responder

Become first responder without animation

喜夏-厌秋 提交于 2020-01-22 13:43:08
问题 Is there a way for a UITextField to become first responder without the animation of the keyboard? That is, make it such that the keyboard just appears? Basically, I'm pushing a second UIViewController over the UIViewController that has the UITextField , and when that second view controller gets popped off the stack, I want the UITextField to immediately have first responder status so that when the second view controller gets popped, the user never notices the text field wasn't first responder

Become first responder without animation

天大地大妈咪最大 提交于 2020-01-22 13:43:04
问题 Is there a way for a UITextField to become first responder without the animation of the keyboard? That is, make it such that the keyboard just appears? Basically, I'm pushing a second UIViewController over the UIViewController that has the UITextField , and when that second view controller gets popped off the stack, I want the UITextField to immediately have first responder status so that when the second view controller gets popped, the user never notices the text field wasn't first responder

Disable button as long as several textfields are empty

浪尽此生 提交于 2020-01-21 19:25:28
问题 I have the following code to disable a button as long a textfield is empty: func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { let text = (textField.text! as NSString).replacingCharacters(in: range, with: string) if !text.isEmpty{ addButton.isEnabled = true } else { addButton.isEnabled = false } return true } It works fine, but now that I have 3 textfields, I want the button only to be enabled, if all textfields are