uitextfield

UITextField SecureEntryText color changes

蓝咒 提交于 2019-12-10 10:10:31
问题 I have a subclass of UITextField where I set the text color to be white. I am using this subclass for an email field and a password field. - (void)drawRect:(CGRect)rect { [super drawRect:rect]; self.clearButtonMode = UITextFieldViewModeWhileEditing; self.layer.backgroundColor = [UIColor clearColor].CGColor; self.textColor = [UIColor whiteColor]; [self setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"]; ...... ...... The password field has secureTextEntry set to YES , and

UITextField — Adding UIView for leftView - Can't get Focus

守給你的承諾、 提交于 2019-12-10 10:01:35
问题 The UITextFields in my app have placeholder text defined (in Interface Builder), and I cannot cause these fields to acquire focus (i.e. show the keyboard and allow editing) when I tap on the area occupied by the placeholder text. If I tap on the textfields in an area just outside the that of placeholder text (though still within the bounds of the textfiled itself), it acts as normal (i.e. the keyboard pops up and I can edit the content of the textfield). How can I fix this? Thanks. EDIT 1 Ok,

QuickType predictions take key strokes into account that should be blocked by my UITextFieldDelegate

旧街凉风 提交于 2019-12-10 07:47:07
问题 I have a textField, in which I don't want to allow leading whitespace. So I implemented textField(textField:shouldChangeCharactersInRange:replacementString:) and block attempts which would change the text to something that starts with whitespace. This works as expected. Unfortunately this messes up QuickType. Each time I press space in an empty field, which is then ignored by my textField, the Quicktype text gets prefixed with this space. To be more clear, the text that QuickType will insert

Use the system keyboard without a UITextView or UITextField

你离开我真会死。 提交于 2019-12-10 07:14:16
问题 I am creating an app with core graphics that needs to take text input and place characters at specific pixel offsets. Do I have to subclass UITextField or something and re-invent the wheel (redefine it to be a more abstract text entry widget - really I only need the events a UITextField generates) or can I somehow show the keyboard, receive it's events and dismiss it myself! Thanks! 回答1: You could instantiate a UITextField with a frame that makes it invisible (off the "screen" to the left or

How to write a Custom UItextField Class

社会主义新天地 提交于 2019-12-10 05:43:43
问题 In my app, i need to use a lot of textfields and i don't really want that every viewcontroller class contains the delegates of textfields which could be messy, I just want to create a generic class where it takes care of the delegate of textfields and returns me a text field where i can add it as a subview where ever i need. I want to make it as a library and call the class whenever i need a textfield FOR example CustomTexTField *textField = [[CustomTextField alloc] initWithFrame:Frame]; //

How do I resignFirstResponder when I click outside of a UITextField onto a UITableView

与世无争的帅哥 提交于 2019-12-10 04:24:46
问题 I am having trouble getting the keyboard in my iPhone app to go away because the UIView even when made a controller is not touchable because of the fact that I have a UITableView taking up the rest of the available screen. I was curious to know how I would go resigning the keyboard aka firstResponder by clicking onto the UITableView ? Is there a way to monitor a touch event on the UITableView even if it is not to select a clickable cell. Basically, I know how to resign the keyboard if the

Textview with Suggestions List in iOS

旧时模样 提交于 2019-12-10 04:21:19
问题 I am trying to implement a textView in which when user starts typing(Let's say names) it would show up the suggestions and when they click them it gets added to the textView than user presses comma and again the same functionality for another name.... And at the end the text in the textView should look like this... Aron,Maria,Alex,Cassie Can any one suggest me How can I achieve this? (Its somewhat similar to adding the "Tags" while posting this question!!!) Thanks. 回答1: You can use a

UITextField keyboard doesn't appear

旧巷老猫 提交于 2019-12-10 04:12:07
问题 I have a very simple screen with an UITextField with the default configuration, nothing special. When I touch the UITextField, the keyboard doesn't pops up. I haven't any custom control, behavior or anything else, just that, but it doesnt'work. I've done this in previous apps iPhone/iPad apps already on the AppStore but i can't figure out what's going wrong here. The UITextField is created in Interface Builder, in the nib file. I've been doing some research and i added an IBAction in the

How to auto fetch OTP, if we use multiple text fields

喜你入骨 提交于 2019-12-10 03:24:20
问题 I know that if we want to auto fetch the OTP(if we use single textfield) we need to use otpTextField.textContentType = .oneTimeCode But, If we use multiple textfield(According to following image) how should we achieve this ? 回答1: If you can get the auto OTP for single field, you can split that text into your four text fields. I believe. You may have to use textField's change observer as like below, textField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) func

textFieldDidBeginEditing: for more than one textfield

不羁的心 提交于 2019-12-10 02:12:03
问题 I am fairly new to iphone programming and here I am facing some issues. Now in my application, I have two textfields and I want to fire an event while second textfield starts editing. now I am using following function - (void)textFieldDidBeginEditing:(UITextField *)textField but the thing is the event is being fired when the first textfield starts editing. It does not wait for the second text field. Is there any way I can use this function for the second textfield or may be somehow could know