iOS UITextField formatted for time - iphone

I have a UITextField which I created programmatically. This text field is used to input a time. The placeholder text is "00:00:00.000". When the text field is tapped, a number pad will appear. Ideally, I want the gray place holder text to remain as the user types. As they enter a number, it replaces the gray zeros in the place holder text and skips over the colons and period (leaving the format intact without the user entering any punctuation). If it is not possible to keep the place holder text and replace it as the user types, I would like the punctuation to automatically be entered.
Thanks in advance!

iOS has a UIDatePicker control for this, if you want to go the way you are going then you will have handle all the user input your self.

Related

Word 2010: expand a control to fill its table cell

I have a table cell of fixed large size, and in it is nothing but a Plain Text Content Control, whose default placeholder text "Click here to enter text" takes up only a small portion of that table cell.
The problem is that if the user clicks anywhere in the cell but outside of the control's placeholder text, then starts typing, the entered text will not be part of the control and will not be subject to the control's style or any other control properties.
So - other than adding a lot of dummy characters to the placeholder text, which doesn't seem to be predictable in its word-wrap behavior, is there a way to make the control's placeholder text (or, in general, its click-boundary) fill the entire table cell?
UPDATE actually there were some carriage returns after the control that I was not aware of; after deleting those, clicking anywhere in the cell as long as the x coordinate if the click is greater than or equal to the leftmost x coordinate of the control will edit the control text value as desired. If you click leftward of the control, you will end up editing whatever fixed text exists to the left of the control, i.e. a fixed text label. Still strange. The workaround here was to split cells for all multi line text entry areas, such that the label is on its own cell, and the control is now at the leftmost edge of its cell.
Content controls do not support something like expanding to the surrounding container. They will always use only the space that is required to render their content.
If you want to prevent users from clicking and typing text outside of the control, you could use the following approach:
Put a rich text content control around your table/table row/cell
Put the plain text content control as a nested content control in the table cell (the plain text content control must be non-vanishing for this to work)
Make the outer content control read-only
Now the only thing the user is allowed to edit is the inner plain text content control. The downside of this approach is that your document now contains areas that are locked. This has an impact on usability, first, because, it may not be obvious to the user why certain areas cannot be modified, and second, because a lot of standard actions do no longer work if part of the selection is locked (e.g. Select All > Update ToC).

LibreOffice Calc - text in a cell ending with an underscore and by a number will be converted to a small number

In LibreOffice Calc, If you enter text in a Standard cell ending with an underscore followed by a number, then the text is converted in the following way: the underscore is removed and the number is set in a small font (subscript).
Exemple:
If I enter TEST_1 in a cell and press Enter, then the content of the cell is replaced by TEST₁
How is it possible to cancel this behavior ?
The autocorrect behavior depends on the language.
In my case the Autocorrect options (in menu Tools->Autocorrect) were set to French (France).
The autocorrect rules causing this problem were in the form
.*_0 converted to ₀
It is possible to delete these rules to avoid the problem.

What is substitute of keyboard for iphone?

I am making an application in which i have use a keyboard for input in text field. Now my client requirement is that he need a substitute of keyboard input for text field. Basically i have need increment and decrement value of text field. SO i need some other function which is used for increment and decrement value of text field. For that i have use keyboard and now i require any other function like increment and decrement operator or tap to increment and decrement text or any thing else. What i used for that purpose?
Thanks in advances...
Put a pair of up/down buttons next to the text field. UIButtons will still work when the keyboard is visible. You can also hide these buttons when they aren't needed.

UITextFields firstResponder problem

hello all i am working with multiple uitextfields.i have a problem in cursor placing while changing firstResponder. i would like to do "Cursor placement in 2nd field once we entered the 3rd character in the 1st field." but the cursor stays in 3rd place.here i am restricting my first text field length to 3.
This SO answer should help you. You set up notifications to be issued when the first text field state changes, firing a method that checks the text field's length. If firstTextField.text.length is equal to three characters, call [secondTextField becomeFirstResponder].

How to determine the cursor position of a UITextField?

I have a text field that is always of the format "XX0000000XX", X being a letter, 0 being a number. I switch keyboards as the user is typing depending on whether they need to enter a number or letter.
This works fine, until the user positions the cursor in the middle of the text field to make an edit. How do I determine the cursor position within a UITextField?
I know a UITextView has a selectedRange that can be used, but I've read that you can't force a UITextView to be single line entry? i.e. Disable multiple lines of text.
Clever bit with the keyboards. My immediate thought is that perhaps that you shouldn't allow the user to move the cursor in the first place.
This isn't without precedent in the iPhone UI. The telephone keypad view, for example, restricts the user to sequential input. I have also found this technique useful for currency input. Anywhere with input that has a very rigid syntax, basically, seems like a candidate for this kind of treatment. Might work well for your situation.
Not sure if this is the best method, but here's how I do it:
A UITextField to capture input and a UILabel to display the input. The text field is hidden but is sent becomeFirstResponder to trigger the keyboard. As the user types, delegate methods do their thing to format the text, if necessary (as with currency), and update the UILabel, which provides the user feedback on their input.
Depending upon the situation, you may wish to style the UILabel in such a way that makes it clear the user can't use it as they would a selectable text field while reassuring them that it is, in fact, their input.
With 11 characters in play, I can see how curser editing might be useful. Still, phone numbers are often in that same range and I never have a problem with the sequential editor in the Phone app.
There's a UITextDelegate method -textField:shouldChangeCharactersInRange:replacementString: which should be all you need to do what you describe. Implement it to enforce whatever formatting rules you want. You shouldn't care where the cursor is, just the range of the change that's proposed.