UITextField Clear Button Does Not Show - objective-c

I want to show a clear button always in a UITextField. I have tried to both set this in .xib Interface Builder:
and in code using this line: [_firstNameField setClearButtonMode:UITextFieldViewModeAlways];
Neither causes the button to show. Help please.

When you set it to UITextFieldViewModeAlways the clear button appears as long as there is text on the UITextField.
Hope this helps!

Related

Clear button of UITextField does not appear in iOS 9

The clear button of UITextField gets hidden in iOS 9, it was working perfectly till now in all other iOS versions. I tried out everything from the below links :
(1). UITextField Clear Button Does Not Show
(2). How to change the tint color of the clear button on a UITextField
(3). UITextField clearButtonMode color
The button does not show up till we hover the mouse over its position.
In storyboard, I have selected "appears while editing" option and even tried "is always visible" option, but still the same.
I don't want to create custom button, so please let me know is there anything wrong in iOS 9 or what else can be done to resolve.
Waiting for a positive reply.
Thanks !!
Check the property for the specific button, textfield where you have declared, whether you had mentioned property as "Weak". If at all you have mentioned as weak please change it to "Strong".

Show UITextField above Keyboard

I am using the following tutorial to show the uitextfield above the keyboard at all times:
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-keeping-content-from-underneath-the-keyboard/
But the problem is the uitextfield only gets shown above the keyboard if the person starts typing into the field, but not if the cursor is in the textfield.
How can I change it so that the uitextfield gets shown above the keyboard once the cursor is in the UITextField?
Thanks
Check UITextFieldDelegate and select appropriate method.
In this tutorial they use textFieldDidBeginEditing method to assign active textfield.
As it clear from method name, it executes when someone start typing in text field.
I downloaded the sample code and work just fine for me. The only thing that I figured you could misunderstood is in the case the keyboard it's already below the textField, in these cases the view will not scroll.
I hope this helps. If it's not this that you want, please tell me more about it.

How can I create UIKeyboard with done button on top right corner?

I need to show UIKeyboard with done button on top right corner ..please look into attached image..any help would be appreciated.
This might help you. please check it out BSKeyboardControls
Create a UIToolbar keep two bar buttons in that. Initially Hide that toolbar.
Show the toolbar on the textfield didBeginEditing delegate of textfield
and hide the toolbar in didEndEditing delegate of textfield
EDIT: As prashant said BSKeyboard offers what i said. See the look and feel of it here http://www.cocoacontrols.com/platforms/ios/controls/bskeyboardcontrols
You should set inputAccessoryView propery of UITextField or UITextView to your custom view with all required buttons
#property(readwrite, retain) UIView *inputAccessoryView
Description
The custom accessory view to display when the text field becomes the
first responder The default value of this property is nil. Assigning a
view to this property causes that view to be displayed above the
standard system keyboard (or above the custom input view if one is
provided) when the text field becomes the first responder. For
example, you could use this property to attach a custom toolbar to the
keyboard.

Getting UIPicker to appear when user selects a UITextField

I have a simple UITextField called month where I get users to simply enter the month they want via the keyboard that comes up. I would now like it for them to be able to use a UIPickerDate (or UIPicker) to make this selection instead. So when they press on the text field, a mini UIPicker appears and they make there selection, press anywhere on the screen and the picker disappears.
Does anyone know how to do this or has any suggestions? I am pretty new to programming and have looked at other answers but everyone seems to be referring to this being done in a table.
Thanks in advance!
You can set the inputView property on the UITextField to be an instance of UIDatePicker. When the instance of UITextField becomes the first responder, the picker view will be displayed with the standard keyboard animation.
// Assume that self.monthTextField and self.datePicker
// are properties of the view controller class
self.monthTextField.inputView = self.datePicker;
As for dismissing, that depends on the context. If there are more text fields to populate, consider adding a UIToolbar as the inputAccessoryView of self.monthTextField. Then you can add something like a UIBarButtonItem to make the next text field the first responder, similar to how the standard keyboard provides a Next button.

NSTextView wont update unless I click on it, and it wont focus. Any ideas?

I dont have time right this second to put some sample code, (Ill edit my question tomorrow and add some) but basically what happens is that I have a Window. It works fine usually, but if I use
[myWindow setStyleMask:NSBorderlessWindowMask]
to make it borderless, the NSTextView it contains will stop gaining focus even when you click on it: the ring will never appear, the cursor wont change and the scroll bar will remain gray.
Something else that happens when I make it borderless is that it wont update! I basically have this
[lyricsView setString:someString];
to update the string inside it. The Console marks me no errors, but the string wont appear in the Text View unless I click on it.
All of this stops happening if I remove the line setting the styleMask to Borderless. Any ideas? Suggestions? Comments? Cheers?
Thank You!
Kevin
From the documentation of NSWindow:
The NSWindow implementation returns YES if the window has a title bar or a resize bar, or NO otherwise.
So subclass your window and add this line
-(BOOL)canBecomeKeyWindow
{
return YES;
}