How do I set a UITextField as the default input field at app launch - ios

I am writing an iPhone app with a keypad and two TextFields on a single view. The user types into each of the text fields. Because I want to use an on-screen keypad, I disabled the the keyboard from launching when each TextField is selected. (I used the method suggested in this thread:
Disable UITextField keyboard?
So far so good EXCEPT the cursor doesn't blink in the either of the two TextFields until they are selected. If I just begin typing without selecting, the first textfield is filled. That's OK, but I would like to set the cursor flashing in that field so the user is notified that that is where the input will go unless they select the other field.
I did not create the text fields programatically. I created them with Interface builder.
How do I programatically select the desired starting text field (ideally some highlight would show up when selected). Right now I just got lucky and the field I want to be the default is the default.
How do I place the flashing cursor onto the right side of that text field.
...Dale

Call [myTextField becomeFirstResponder]; this will notify the receiver that it is about to become first responder in its window. That should set the Cursor in the UITextField.

To programmatically activate a field and make it your starting text field you should use UIResponder's becomeFirstResponder method, which all UITextFields inherit from.
[textField becomeFirstResponder];

Related

Hide TextField selection handles

Im my application when the user selects a TextField the existing text gets automatically selected when the Focus changes to the textfield. How do I hide the blue selection handles that appear?
The reason I want to automatically select the existing text is so that the user can begin typing and the textfield will automatically overwrite the existing value instead of appending to it.
I figured it out. You can set the enableInteractiveSelection property to false.

How to disable isEnable and isUserInteraction attributes but keep cursor show in UITextField?

I have a custom framework for UITextField. For now, I want to disable two attribute as the question above but still keep the cursor show in my custom textfield. I already disable the keyboard with set the inputView = UIView(), and that successful for hide the keyboard even show the cursor inside textField.
My goal is disable both attributes like above or another for can not Select All action from my textField, but still keep the cursor available anytime.
Hope to hear the ideas from you guys. Thank a lot!

Swift ios8: How to make single row picker with option for manual text entry?

I would like to give my iPhone App user the option of whether to use a picker (i.e., scroll wheel) or keyboard to input the value of a field. I'd like it to where the current value of the field effectively displays as isolated text (i.e., as a label, with the picker and keyboard hidden). But the user can change the field's value by either (A) performing a single tap on the label to reveal the keyboard so the user can type in a different value; or (B) perform a swipe on the label to reveal the picker so the user can user the picker to change the value. This will present a very clean interface in my opinion, without the clutter of the keyboard, text field, or picker unless the user changes the value. Help?
This control doesn't exist, but a possible solution would be to add a cell under the UIPickerView (assuming your using a table form) when the "Custom" option is selected and add a text field to that cell allowing custom input. Make sure you hide the cell if the UIPickerView value changes from "Custom" to avoid user confusion.

How to select a UITextField without showing UIKeyboard

I am wondering if there is a way to use a UITextField programatically (i.e. use buttons as inputs) so that you can select a UITextField but not show the UIKeyboard, then when you select a UIButton it would assign a string value to the currently selected UITextField.
I don't really know where to start.
I think you can visually change the appearance of the text field (for example add a blue border), let the user feel it’s “selected”. Then you just modify textfield.text when user presses button.
Or alternately, you can create a customized keyboard. There are many similar questions.
It seems that you don't really need a text field (e.g., edit/select text, etc.), but a "button that stays highlighted" instead. Then, you can programmatically change the button's title label to the specified string when the user taps the 'proper' buttons.

Stop UITextField cursor from blinking in iOS

Is there a way to stop the cursor from blinking in a UITextField? I know you can use [UITextField resignFirstResponder] and [UITextField setEnabled:NO], but I'd like to keep the keyboard visible on the screen.
Thanks!
Update
To clarify, I have no intention of hiding the cursor while the user is editing the text field, but I want to hide it after the user has hit Done and a progress indicator has appeared above the text field. A blinking cursor seems weird in a view that can't be manipulated with.
You can create an invisible text field and make it the first responder. Once you're done, you can set the first responder back to the original text field and remove the invisible text field.

Resources