uitextfield

iOS Programmatically Add Left image to UITextField in Xcode?

走远了吗. 提交于 2019-12-23 06:15:39
问题 ** iOS Programmatically Adding Left image to UITextField in Xcode? ** 1) I want Take a UIview with White Background color , inside the View i added 4 Textfield's ? 2) I want to add 4 different images to the left side of the 4 different textfields inside a View Having following properties? Properties For View i) corner Radius --- 5 ii) Border Color ---- light Gray Color 3) How to add Space between the image and Placeholder Text inside the Textfields from the below figure and also add layer for

iOS Programmatically Add Left image to UITextField in Xcode?

。_饼干妹妹 提交于 2019-12-23 06:15:21
问题 ** iOS Programmatically Adding Left image to UITextField in Xcode? ** 1) I want Take a UIview with White Background color , inside the View i added 4 Textfield's ? 2) I want to add 4 different images to the left side of the 4 different textfields inside a View Having following properties? Properties For View i) corner Radius --- 5 ii) Border Color ---- light Gray Color 3) How to add Space between the image and Placeholder Text inside the Textfields from the below figure and also add layer for

Moving keyboard when editing multiple textfields with constraints swift

笑着哭i 提交于 2019-12-23 05:29:10
问题 I have UIViewController which looks like this: I set all the relevant constraints . I'm trying to shift the UIView up when the keyboard shows up - when I click on the UITextfields below. I have the following code: static func addRemoveKeyboardObserver(addObserver: Bool, keyboardMargin: CGFloat, view: UIView?) { Utils.keyboardMargin = keyboardMargin Utils.heightChangingView = view if addObserver { NotificationCenter.default.addObserver(self, selector: #selector(Utils.keyboardWillChange

Auto Resign and assign first responder in text field in Swift

心不动则不痛 提交于 2019-12-23 04:48:24
问题 I have taken 3 text fields and want them to hold just one integer for OTP purpose (It's the need of the project design). When user enters number in first textfield, the responder should automatically get assigned to the second text field and then to the third text field. As soon as user enters last OTP digit in the third textfield, I want to hit the webservice. What I did so far is : class ActivationCodeVC: UIViewController, UITextFieldDelegate then otpField1.delegate = self otpField2

Passing of UITextField text from one view to another

℡╲_俬逩灬. 提交于 2019-12-23 04:47:16
问题 I defined a UITextField on my firstViewController as follow // firstViewController.h IBOutlet UITextField *PickUpAddress @property (nonatomic, retain) UITextField *PickUpAddress; //firstViewController.m @synthesize PickUpAddress; // Push secondView when the 'Done' keyboard button is pressed - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; if (textField == PickUpAddress) { SecondViewController *secondViewController= [[SecondViewController alloc]

Hide keyboard by touching background of UITableView

早过忘川 提交于 2019-12-23 04:16:13
问题 I was searching some optimized method to hide keyboard on background tap when UITextFields are in a UITableViewCell . I have made some code Hope this would help you. 回答1: Doing hittest doest seem to be the right way You can implement the touch events on the View on which the tableView resides, like below. Also assign the textField Object to a member variable in textFieldDidBeginEditing , so you will be able to resign the particular text field for which the keyborad is shown. -(void

Swift how to assign a string to a UITextField?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 03:40:25
问题 @IBOutlet weak var resultProcessed: UITextField! var str:String = "Mike is here" resultProcessed = str gives error: Cannot assign a value of type 'String' to a value of type 'UITestField!' 回答1: resultProcessed.text = str You need to assign it to the text property. 来源: https://stackoverflow.com/questions/30093423/swift-how-to-assign-a-string-to-a-uitextfield

Which delegate method I should use to respond to clicks on a text field?

耗尽温柔 提交于 2019-12-23 03:35:09
问题 I want to open a panel when the user clicks on a text field. I think I should use a delegate method that responds to the click event. I found that the - (void)textDidBeginEditing:(NSNotification *)aNotification method does not work, and that the - (void)controlTextDidBeginEditing:(NSNotification *)aNotification method works, but only when I edit the text in the text field, not then I click it. If I edit the text again, this method does not work. Why? Sorry, I think I want to use this on mac ,

UITextField text moving unexpectedly

匆匆过客 提交于 2019-12-23 03:28:10
问题 Below is a demonstration of how the text in my text field is moving when the text field is active. By applying a background to the field, i found that only the text moves, not the whole text field itself. This is not happening to the text field above as well, only the bottom one 回答1: after search for this issue i recommend to change your font to another font. but there is some way to prevent this issue : you can use this : - (void)textFieldDidEndEditing:(UITextField *)textField { [textField

Ios Swift Override double tap of UItextField

戏子无情 提交于 2019-12-23 03:04:30
问题 I want to write a custom code on double tap on UITextField and block the default text editing and popup of the keyboard. I've tried the following and nothing has worked for me so far. Kindly help me solve this problem. let gestureArray = NamTxtBoxVal.gestureRecognizers var tapGesture = UITapGestureRecognizer() for idxVar in gestureArray! { if let tapVar = idxVar as? UITapGestureRecognizer { if tapVar.numberOfTapsRequired == 2 { tapGesture = tapVar NamTxtBoxVal.removeGestureRecognizer