I've created a UITextView and set the autocapitalization property to UITextAutocapitalizationTypeSentences or to UITextAutocapitalizationTypeWords. Both settings work as expected except for the first word that is typed, which is not autocapitalized! It is autocapitalized if the user deletes the text taking the cursor back to the start of the line.
My workaround would be to convert the first letter from uppercase to lowercase in the UITextView delegate method textView:shouldChangeTextInRange:replacementText:.
The only tiny issue that remains is that the user is unable to tap on the shift key to prevent the first word from capitalizing.
Do other people experience this issue and is this what you've done?
Thanks.
I think this may be an issue with the simulator. It seems to be working fine on the device!
Related
As far as I can tell by default the react native text input component has some inconsistencies on iOS from the normal text input when using it in a controlled way. The examples I've found so far:
the "period shortcut" (pressing two spaces to get a period in text) does not work.
typing a special character and then space does not switch the keyboard back to its normal mode
spelling errors do not have a red underline
often text replacement shortcuts don't work
I'm trying to get around this in the short term and so far the only thing I've found that works is using a multiline input. At this point I'm trying to "hack" the multiline input to work like a singleline, but figured it was also worth reaching out to see if anyone else has a better solution.
I'm trying to implement the transfer of a one-time code from SMS to the field above the keyboard, as in the image.
But for some reason the field above the keyboard is not displayed.
Code:self.valueTextField.textContentType = UITextContentTypeOneTimeCode;
UI hierarchy:
+UIView
CustomContentView
UIImageView
UITextField - valueTextField
UITextFieldContentView
I have read these materials:soQuestion and apple docs , and I saw a warning:
If you use a custom input view for a security code input text field, iOS cannot display the necessary AutoFill UI.
... but I do not understand what is meant by custom input view.
Also I have category for UITextField. Can it affect the work?
I will be glad to any ideas, thanks!
Okay. This is what I could find out. Regarding the code, it is enough that I described above. Additional settings on the client is not required. But you need to pay attention to the text of the SMS message. As an example, I attached two messages.
In the first message, our code is defined by the system as a phone number. We can even call it if we click on it. But why do we need to call a one-time code? :)
In the second image, the code is defined as one-time, just what we need. If we click on it, the system will offer to copy it to the clipboard.
What is the difference? Unfortunately, it is not completely clear by what rule the text is parsed in SMS. But we can check your text in the following way:
If you set a property textContentType to your text field and nothing works for you, the first thing you need to check is whether the operating system determines the code correctly. To do this, simply go to the message application and check the code:
blue font color with underscore - the system did not recognize
one-time code.
black font color (as default) with a gray underscore - it's okay!
At the end, in the first case, you should check the text of the message for the contents of incorrect characters.
PS Just a couple of examples of correct and incorrect SMS:
SMS-code: 12345 £ correct
SMS-code: 12345 $ correct
SMS-code: 12345 № correct
SMS-code №1: 12345 incorrect
I got caught out by the fact "Autofill PAsswords" was turned off on the phone.
It seems that it needs to be on for this functionaility to work.
I am busy developing my first android app which is essentially a bubble burst type of game.
So far everything works except when I want to update a text box with a score.
Views are moved using translateanimation and all works as expected as long as a simple .setText() is not used.
When this is added occasionally some views that have been moved around previously suddenly move back to their original position. Additionally some variables also are set back to their original value.
I have tried updating the score via asyntask as well as runonuithread but the same issue occurs.
Thanks
I sorted it out.
I had the text box which I use for the score in a seperate xml and in that xml I had a include statement pointing to another xml file which had all the controls which are used as bubbles/blocks.
By including the score text box in the same xml the issue was sorted out.
There must be some rules that Android has regarding animating/updating controls across two seperate layouts.
I'm creating my own Text Editor in iOS using Core Text. Pretty much everything works great with one exception: Stuff really starts to slow down when the text document is "large". I've discovered that iOS is requesting the entire document text on every change, including selection changes (at least, when I notify the UITextInputDelegate of selection changes). Part of the problem is that I've already optimized my Core Text code by splitting up the document into paragraphs and rendering only the paragraphs that change. But doing this also split up the document string (which is a NSAttributedString) into the separate 'paragraph objects'. So when iOS requests the entire text document, I have to combine all those strings into one string, which takes time and memory.
My solution is to give iOS incorrect UITextPosition's for the beginningOfDocument and endOfDocument methods, limiting those positions to the paragraph(s) intersecting the current selection. This is actually working very well. iOS is now only requesting the current paragraph(s) of the change, which has completely eliminated the slow-down.
So far, so good, but I'm a little worried that this might break something. I've tested this a bit and nothing is broken, but Text Editors can be hard to test (who knows if it'll break in some edge condition).
I have 2 question:
Should iOS be requesting the entire document text on each change? If not, then perhaps some other method in my UITextInput protocol methods that are returning the wrong value, somehow causing iOS to request the entire document.
Does anyone know if this will actually break anything?
Alright, I've been testing this for quite a while now and I've finally found a place where using this technique will break functionality. UITextInput uses beginningOfDocument and endOfDocument to determine whether it has room to "move" when you press the arrow keys on a bluetooth keyboard. Returning only the beginning and end of the currently selected paragraph(s) cause it to ignore the 'arrow' buttons when it is at the beginning or end of that paragraph and those arrows indicate an attempt to move outside what it thinks is the beginning/end of the document. It's easy enough to fix. If the currently selection begins at the beginning/end of a paragraph, I now also return the previous/next paragraph as part of the document, respectively.
I want to disable the space character from the virtual keyboard on my iOS application when users edit an input text.
Users should enter a nickname. So I want to remove all space characters.
Thanks.
Trying to modify the standard keyboard requires taking a dangerous path into private APIs and a broken app in future iOS versions.
I think the best solution for you would be to implement the textField:shouldChangeCharactersInRange:replacementString: method of UITextFieldDelegate and replace whitespace characters with the empty string.
Once this is implemented, hitting the space bar will simply do nothing.