I realize there are a lot of questions like this already, but read on please, this one is most likely different.
So I have been working on a calculator app, and I would like the user to be able to press a button and be provided with the layout for a mathematical function (square, sqrt, log, etc.). This is a little hard to explain, so here is a screenshot of what I need, directly from Apple's grapher app:
See, the user can press one of these, and it will be inserted into the text field directly, and the user can then edit any attributes.
I would like to accomplish this while still being able to use a UITextField, so really, any suggestions or recommendations would be much appreciated, I just can't solve this.
Related
I am trying to implement the accessibility to my ios project.
Is there a way to correct the pronunciation of some specific words when the voice-over is turned on? For example, The correct pronunciation of 'speech' is [spiːtʃ], but I want the voice-over to read all the words 'speech' as same as 'speak' [spiːk] during my whole project.
I know there is one way that I can set the accessibility label of any UIElements that I want to change the pronunciation to 'speak'. However, some elements are dynamic. For example, we get the label text from the back-end, but we will never know when the label text will be 'speech'. If I get the words 'speech' from the back end, I would like to hear voice-over read it as 'speak'.
Therefore, I would like to change the setting for the voice-over. Every time, If the words are 'speech', the voice-over will read as 'speak'.
Can I do it?
Short answer.
Yes you can do it, but please do not.
Long Answer
Can I do it?
Yes, of course you can.
Simply fetch the data from the backend and do a find-replace on the string for any words you want spoken differently using a dictionary of words to replace, then add the new version of the string as the accessibility label.
SHOULD you do it?
Absolutely not.
Every time someone tries to "fix" pronunciation it ends up making things a lot worse.
I don't even understand why you would want screen reader users to hear "speak" whenever anyone else sees "speech", it does not make sense and is likely to break the meaning of sentences:
"I attended the speech given last night, it was very informative".
Would transform into:
"I attended the speak given last night, it was very informative"
Screen reader users are used to it.
A screen reader user is used to hearing things said differently (and incorrectly!), my guess is you have not been using a screen reader long enough to get used to the idiosyncrasies of screen reader speech.
Far from helping screen reader users you will actually end up making things worse.
I have only ever overridden screen reader default behaviour twice, once when it was a version number that was being read as a date and once when it was a password manager that read the password back and would try and read things as words.
Other than those very narrow examples I have not come across a reason to change things for a screen reader.
What about braille users?
You could change things because they don't sound right. But braille users also use screen readers and changing things for them could be very confusing (as per the example above of "speech").
What about best practices
"Give assistive technology users as similar an experience as possible to non assistive tech users". That is the number one guiding principle of accessibility, the second you change pronunciations and words, you potentially change the meaning of sentences and therefore offer a different experience.
Summing up
Anyway this is turning into a rant when it isn't meant to be (my apologies, I am just trying to get the point across as I answer similar questions to this quite often!), hopefully you get the idea, leave it alone and present the same info, I haven't even covered different speech synthesizers, language translation and more that using "unnatural" language can interfere with.
The easiest solution is to return a 2nd string from the backend that is used just for the accessibilityLabel.
If you need a bit more control, you can pass an AttributedString as the accessibilityLabel with a number of different options for controlling pronunication
https://medium.com/macoclock/ios-attributed-accessibility-labels-f54b8dcbf9fa
In some applications and websites there are only a limited selection of options but too many to scroll through so the application or website will allow the user to begin typing their answer in a Text_Field and then show in a Picker_View the possible options based on what the user has typed in. Is there an easier way to do this rather than use an absurd amount of "if-then" statements to filter out each option?
Depending on how many options you have to sort through, we have used both tableviews and actionsheets in my company. Actionsheets don't have a easy search and we only use them if we have less than ten options. But they provide a large data picker type selection. Tableviews are pretty easy to add searching into. I have used a lot of tutorials from raywenderlich.com. And I used this one to build my first searchable tableview.
Hope that helps. Happy coding!
Is there currently any way, without Private APIs, or with, to extract the source code as an object to be able to interact with it, in the form of a UIWebView for example, or a UITextView or just a long string?
Scenario:
There is an enterprise developer. A company wants all IT managers to be able to see all source code, in real time, or otherwise, for feedback and/or interaction. Things like post-it style comments, or drawing will be left in areas that need improvement/alteration, etc. All managers should be able to see methods/functions and essentially all implementations as is.
I have a few ideas on how I want to implement this, but just thought it would be good to get some outside suggestions, because brainstorming never hurts. Is there any thoughts on where I should be looking for simplicity?
I want to add Autocorrection and Suggestion to my custom keyboard.
There are already several similar questions on Stack, but there is only said about UILexicon which as I understood is only used to get user's shortcuts and that there is no way to acces Apple Autocorrection and Suggestion library.
I also saw some questions regarding UITextChecker but don't know if it has an access to Apple's native sugesstion library?
May be there are some new classes for that?
I use four different systems for my keyboard:
I have a list of the top 30,000 or so words, ranked in order of the most used to the least used. You can pay for lists, I just got a free one of about 42,000 and edited it down a lot.
guessesForWordRange is provided by Apple. It will guess words that are close to what you have typed. It does a fairly good job, but I had to filter out some things. The top guess sometimes has quotation marks around it, but other then that it works great.
completionsForPartialWordRange is also provided by Apple. It will return completed words, but in alphabetical order, not ranked by usage. Not much good on it's own, but is a great supplement to 1 and 2. (if this worked correctly #1 wouldn't be needed)
Special cases. Mainly for contractions. When someone types didnt, I wanted it to auto choose didn't. So I have almost all contractions specifically programmed in.
So my word suggestions and autocorrection aren't perfect, but it does a decent job.
Hope this helps.
Edit: As of iOS 16 it seems completionsForPartialWordRange is working correctly, so having your own list of words shouldn't be needed anymore.
I am wondering if it is possible to have a custom dictionary of suggestions when editing in a certain text field in iOS 4.2
As you can see in the picture below, the default dictionary of suggestions is the english dictionary. What I would like to know is that if it is possible to give it, for example, an array of strings so that the text field would only give out those strings as suggestions.
Not easily, unfortunately.
It seems like you have two options if you want to do this and neither look easy.
1. Roll your own suggestion overlay code and disable Apples stuff.
2. (Really sketchy) See if you can leverage the fact that iOS includes names of contacts when entering text. I believe it does this at least to capitalize names, but it may also use this to autocomplete them.