In Daniel Devesa Derksen-Staats' book 'Developing Accessible iOS Apps', the following example is included to show how IPA (International Phonetic Alphabet) notation can be used to specify the VoiceOver pronunciation:
let ipaAttributedText = NSMutableAttributedString(string: "Paella is a Valencian rice dish")
let ipaRange = ipaAttributedText.string.range(of: "Paella")!
ipaAttributedText.addAttributes([.accessibilitySpeechIPANotation: "paˈeʎa"], range: NSRange(ipaRange, in: ipaAttributedText.string))
ipaLabel.attributedText = ipaAttributedText
// Excerpt From: Daniel Devesa Derksen-Staats. “Developing Accessible iOS Apps.” Apple Books.
The result, at least in iOS 15, is clearly not what was intended. The accessibility label, as it appears in the VoiceOver caption is "ipa, Paellais a Valencian rice dish" - and this is how it is read. The VoiceOver synth's pronunciation is roughly 'paylace', that is, it is completely ignoring the phonetic transcription (I can replace "paˈeʎa" with literally anything, the pronunciation doesn't change). Also any whitespace between the target word and what follows is deleted in the caption and pronunciation. In the console, I can output the value of the ipaAttributedText, everything there looks ok:
Paella{
UIAccessibilitySpeechAttributeIPANotation = "pa\U02c8e\U028ea";
} is a Valencian rice dish{
}
This blog post contains a very similar example, differing only in that it sets the .accessibilityAttributedLabel instead of .attributedText, but it fails in the same way.
Is this broken on iOS 15? or is there something else needed to make this work?
Related
When editing a vertex I would like to substitute the vertex symbol with SimpleMarkerSymbol and a TextSymbol but that appears to be impossible. Any suggestions on how I could do this? I want the appearance of dragging something like this (text + circle):
After taking some time to look at the API I've come to the conclusion it is impossible. Here is my workaround:
editor.on("vertex-move", args => {
let map = this.options.map;
let g = <Graphic>args.vertexinfo.graphic;
let startPoint = <Point>g.geometry;
let tx = args.transform;
let endPoint = map.toMap(map.toScreen(startPoint).offset(tx.dx, tx.dy));
// draw a 'cursor' as a hack to render text over the active vertex
if (!cursor) {
cursor = new Graphic(endPoint, new TextSymbol({text: "foo"}));
this.layer.add(cursor);
} else {
cursor.setGeometry(endPoint);
cursor.draw();
}
})
You could use a TextSymbol to create a point with font type having numbers inside the circle. Here is one place where you can find such font. http://www.fontspace.com/the-fontsite/combinumerals
Wont be exactly as shown in the image but close enough. Also some limitation it wont work with IE9 or lower (this is as per esri documentation, as I am using halo to get the white border).
Here is the working Jsbin : http://jsbin.com/hayirebiga/edit?html,output use point of multipoint
PS: I have converted the ttf to otf and then added the font as base64, which is optional. I did it as I could not add the ttf or otf to jsbin.
Well, Achieve this seems impossible so far however ArcGIS JS API provides a new Application/platform where you can generate single symbol online for your applications.
We can simply create all kind of symbols(Provide by ESRI) online and it gives you on the fly code which you just need to paste in your application.
This will help us to try different type of suitable symbols for the applications.
Application URL: https://developers.arcgis.com/javascript/3/samples/playground/index.html
Hoping this will help you :)
I'm currently making a facebook-like tagging view, i.e. the user types in #name and a view is filtering the names of people which matches the #name. When the user taps a name in that view the currently typed word, in this case #name, will be replaced with the name of the tapped user. For instance, let's say I type #joh I will receive the suggestion "John Doe" which I the proceed to tap. Now #joh is replaced with John Doe. This works fine.
However, I would also like to make "John Doe" a different background color using NSAttributedString, and I have the code to do this as well. The issue I'm experiencing however is that the user might not be done typing and every single character typed after I add the NSBackgroundAttribute causes all the following text receiving the same background color.
I've checked my range for when I add the NSAttribute and it's set to, in this example with John Doe, to be start: 0 and end: 8, but even so I still get the background color on characters that are on a location above 8. What am I missing here?
Code
let tappedUserName = user.name
let myRange = (textView.text as NSString).rangeOfString(tappedUserName)
let attribute = [NSBackgroundColorAttributeName: UIColor.blueColor()]
let myString = NSMutableAttributedString(string: textView.text)
myString.setAttributes(attribute, range: myRange)
textView.attributedText = myString
After this code is executed I continue typing the UITextView's following characters will have the same background color.
I'm following a tutorial(http://youtube.com/watch?v=xvvsG9Cl4HA 19 min 20sec) and to make his code look neat he puts some on a ew line like this
if let myPlacement = myPlacements?.first
{
let myAddress = "\(myPlacement.locality) \
(myPlacement.country) \
(myPlacement.postalCode)"
}
. But when I try I get an error
unterminated string literal
and
consecutive statements on a line must be seperated by a ';'
but the guy in the tutorial has done it the exact same way. What's going on?
I'm using the latest swift and and latest xcode 7.2 any help would be apreciated
if I write everything on the same line like this
if let myPlacement = myPlacements?.first
{
let myAddress = "\(myPlacement.locality) \(myPlacement.country) \(myPlacement.postalCode)"
}
it works fine though
if I write everything on the same line like this
Well, there's your answer. You are not permitted to break up a string literal into multiple lines as you are doing in your first example. There are languages that permit this, but Swift is not one of them. This is not legal:
let s = "hello
there"
There is no magic line-continuation character which, placed at the end of the first line, would make that legal.
If the window is narrower than the line, the editor may wrap the line, for display purposes; but you cannot put actual line breaks inside a string literal.
You can work around this by combining (concatenating) multiple string literals, if you think that makes for greater legibility. This, for example, is legal:
let myAddress = "\(myPlacement.locality) " +
"\(myPlacement.country) " +
"\(myPlacement.postalCode)"
I look your video tutorial carefully. You have a misunderstanding here.
You must pay attention to the video, the code in this picture is not break lines because he add a return here, it is because his screen is too narrow.
So, the real code is
let myAddress = "\(myPlacement.locality) \(myPlacement.country) \(myPlacement.postalCode)"
Please watch it carefully.
And you may need know first, \ in \(myPlacement.locality) is a escape character, it means to get the value of myPlacement.locality and put in the string.
I try add my own characters in keyboard.
I expand key 'z' by code to "Keyboard-en.plist":
"Roman-Accent-z" = {
Keycaps = "z mylongstringtitle ..."; // ... == \U017e \U017a \U017c characters ('z' with apostrophes and dots)
Strings = "z mylongstringvalue ...";
};
But keyboard not shown my string 'mylongstringtitle', only blank space ' ':
I can add only string 4 chars length on normal font and 7 chars on small font on 'button'. But I need add a long string.
Can I add 'mylongstringtitle' inside keycaps's string? May be I need set special parameters for long string? This is possible?
I don't think you will be able to add long string to be displayed in keyboard-en.plist. I believe the limitations of 4/7chars that you discovered are hard-coded in desire to avoid disfigured popup.
This keyboard behavior is not supported by Apple (it's not documented on http://developer.apple.com, or http://devforums.apple.com). Use of this feature in your app, therefore, is undefined behavior, which is considered programmer error.
That said, it's a neat feature. The limits of 4 and 7 characters for keycaps are hardcoded on iOS. I can't find them in any of the keyboard plists. You'd probably have to modify the keyboard binary to do what you want. (On OS X, on the other hand, this limit does not exist.)
A few alternatives exist, which you might know about:
You could modify this custom keyboard project
You could assign a custom inputView to be displayed at the top of the system keyboard
CMS users tend to paste anything into CMS text editors. To prevent website destruction - and as log as there's no non-wysiwyg editor (like markitup) for TYPO3, I would like to as least have some good old "force plain text paste" in place.
TYPO3's RTE has a button "pastetoggle, pastebehaviour, pasteastext". But I haven't managed to configure it so it's always active.
Also, there's an extension ad_rtepasteplain, but it produced no result in TYPO3 6.1.
Is there a usable way to implement paste-as-plain-text for TYPO3 6.x?
[EDIT]
I found (for user TSConfig)
setup.default.rteCleanPasteBehaviour
setup.override.rteCleanPasteBehaviour
as well as (for page TSConfig)
buttons.pastetoggle.setActiveOnRteOpen
buttons.pastetoggle.hidden
... none of which I got running yet. If that's the way to go: is there a working tutorial?
Got it. This is my current setup
RTE.default {
enableWordClean = 1
removeTrailingBR = 1
removeComments = 1
removeTags = center, font, o:p, sdfield, u
removeTagsAndContents = link, meta, script, style, title
hidePStyleItems = h5,h6,pre,address,div
// buttons
showButtons = chMode, formatblock, insertcharacter, removeformat, unorderedlist, orderedlist, outdent, indent, link, copy, cut, paste, showhelp, about,line, bold,pastetoggle, pastebehaviour, pasteastext
buttons.pastetoggle.setActiveOnRteOpen = 1
buttons.pastetoggle.hidden = 1
}
as well as setup.override.rteCleanPasteBehaviour=pasteStructure or plainText in user TSConfig