uitextfield

UITextField with rounded corners only on top

旧城冷巷雨未停 提交于 2019-12-05 20:28:37
I want to implement an UITextField which has rounded corners only at top left and top right corner. I know about the setter method setCornerRadius: which is a default option of UITextField, but this option only allows me to make all four corners of the txtfield round, but i only want the corners on the top to be round. I'm now messing around since hours, I have read through Appple's docs a dozen of times, but I'm still unable to find out why my code wont work: - (id) init { // init elements UITextField *txt_password = [[UITextField alloc] init]; UIView *txt_password_paddingVc = [[UIView alloc]

How can I get UITextFieldDelegate.shouldChangeCharactersInRange to fire with custom inputView?

房东的猫 提交于 2019-12-05 20:25:51
问题 I have a custom keyboard that I'm using to edit the text in mytextField and it works great. However, I can never get the shouldChangeCharactersInRange delegate to execute using my custom keyboard. It does execute when I use my actual keyboard(obviously not the default iPhone keyboard, since I'm set mytextField.inputView = numberPad.view). What should I do to cause the shouldChangeCharactersInRange delegate to fire using the custom keyboard? BTW, the custom keyboard is just a bunch of buttons.

iOS - How to set textfield hint to italic (with regular actual text)?

北城余情 提交于 2019-12-05 19:53:47
Is there any easy way to set a text field's hint to italic, while keeping the actual text non-italicized? The image below shows what I'm trying to accomplish, but doesn't actually work, as text typed into the first text field is still italicized. If there's no easy way to do this, I'm thinking that I'll have to implement methods on each of the text fields to check the length of the text, and if zero apply the italic font. This would work, right? Is there a better way? Try this: UIFont* italicFont = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]]; [yourTextField setValue:italicFont

Tapping between UITextFields in iOS7

时光怂恿深爱的人放手 提交于 2019-12-05 19:32:08
When a UITextField is selected and has a keyboard shown, if I tap other parts of the view the keyboard disappears. If I tap another UITextField , the keyboard stays up, the first textfield is deselected, and nothing happens. Then I need to tap on the other UITextFIeld again for selection to happen and a keyboard to appear. Is there a way to make a second UITextField immediately accessible when a first UITextField is selected? If you reload the tableview in textFieldDidEndEditing , you'll break selection in this way. Don't do that. try it, press another view should call below fn. -(void

Can I change property UIReturnKeyType of UITextField dynamically?

落爺英雄遲暮 提交于 2019-12-05 19:19:21
问题 we can set this property of UITextField to "Send", "Search", "Go", etc.: @property(nonatomic) UIReturnKeyType returnKeyType But setting it while using the UITextField doesn't change at all. I want this behavior: When UITextField is empty, let returnKeyType be "Return", otherwise let returnKeyType be "Send". 回答1: Normally the returnKeyType and other properties are checked when the keyboard is displayed, but are not monitored for later updates. Try calling reloadInputViews on the text field

Dynamic searching in tableview in iOS

笑着哭i 提交于 2019-12-05 18:27:59
I've a tableview and text field where I've implemented search method. Right now, when I write some value in textfield and click search button, then it search in the tableview . But, I want it to be dynamic means the moment I start typing in textfield it should start searching without clicking any button . How can I do this? Just Connect this method on Editing Changed Event of your TextField . So, this method is called when you are changing its value. - (IBAction)txtValueChanged:(UITextField)sender { [self dynamicSearchInto:sender.text]; //From here, we are passing text of textField. } Here,

How may i customise all UITextField appearances for borderWidth?

半世苍凉 提交于 2019-12-05 17:06:36
i am trying to customise all UITextField appearances for borderWith. Trying something like this. Only first 2 lines are making a difference. Rest of the lines not working ? [[UITextField appearance] setBackgroundColor:[UIColor greenColor]]; [[UITextField appearance] setTextColor:[UIColor blackColor]]; [UITextField appearance].layer.cornerRadius = 6.0f; [UITextField appearance].layer.borderColor = [UIColor redColor].CGColor; [UITextField appearance].layer.borderWidth = 3.f; Unfortunately the appearance proxy doesn't work on layers to do what you want you should subclass UITextField and do your

Swift 2 addObserver for specific textField with the object parameter

喜夏-厌秋 提交于 2019-12-05 16:57:54
To my understanding the object parameter of the addObserver method is the object you want to receive notifications from. Most of the time I see it as nil (I assume this is because notifications of the specified type are wanted from all objects). In my particular case I have a text field at the top of the screen and at the bottom of the screen and I want the view to move up only when the user taps the bottom text field, not the top one. So I call the following method in viewWillAppear func subscribeToKeyboardNotifications() { NSNotificationCenter.defaultCenter().addObserver(self, selector:

Use the system keyboard without a UITextView or UITextField

六眼飞鱼酱① 提交于 2019-12-05 16:57:09
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! You could instantiate a UITextField with a frame that makes it invisible (off the "screen" to the left or the top for instance, and make sure the parent view is set to clip child views), and then call [myTextField

How to disable text-autocorrection for an UITextField or keyboard? [duplicate]

扶醉桌前 提交于 2019-12-05 16:55:22
问题 This question already has answers here : Disable auto correction of UITextField (6 answers) Closed 6 years ago . I have a case where autocorrection NEVER makes any sense. It's incredibly annoying. Can I disable it for the UITextField? 回答1: With Interface Builder you can disable "Correction" in the "Attributes" Tab in Inspector. Programmaticaly you can use UITextField* textfield = [[UITextField alloc] init]; textfield.autocorrectionType = UITextAutocorrectionTypeNo; 来源: https://stackoverflow