问题描述
如何添加自定义VoiceOver辅助功能 Label
或提示
到App
图标徽章编号?
How do I add a custom VoiceOver accessibility Label
or Hint
to an App Icon Badge Number?
例如,当iOS设置辅助功能> VoiceOver
已启用开启
,VoiceOver会大声朗读屏幕上触摸的项目。对于App Store和Mail图标,大声朗读以下内容:
For example, when the iOS Setting Accessibility > VoiceOver
is turned On
, VoiceOver reads aloud items touched on screen. For the App Store and Mail icons, the following is read out aloud:
邮件图标,VoiceOver说: 邮件。 1条未读消息。双击
即可打开。
Mail icon, VoiceOver says: "Mail. 1 unread message. Double tap to open."
但是 ,对于我正在处理的项目,VoiceOver读出是通用的,并不完全有用:
But, for the project I am working on, the VoiceOver read out is generic and not entirely helpful:
短语 ......新项目 过于模糊,不准确,并且我确定必须有一种方法可以通过设置 accessibilityLabel
, accessibilityHint $来使用自定义字符串更改它c $ c>或类似的东西。
The phrase "... new items" is too vague, not accurate, and I'm certain there must be a way to change this with a custom string to make it read better through setting an accessibilityLabel
, accessibilityHint
or something similar.
但是在Swift代码中究竟如何?
But how exactly in Swift code?
非常感谢。
其他观察:
使用模拟器辅助功能检查器,VoiceOver值似乎来自标签
- 我的应用程序和值
- 123个新项目。在代码中更新了我尝试将 accessibilityValue
设置为自定义 - 123自定义描述。但仍然没有运气,VoiceOver继续阅读我的应用.123 新商品。双击打开。
Using the Simulator Accessibility Inspector, it appears the VoiceOver values come from Label
- "My App" and Value
- "123 new items". So updated in the code I have tried setting the accessibilityValue
to something custom - "123 custom description.". But still no luck, VoiceOver continues to read "My App. 123 new items. Double tap to open."
为什么VoiceOver没有按预期读取自定义徽章值?
代码:
以下方法添加一个红色圆圈App图标徽章编号到我的应用程序的图标:
The below method adds a red circle App Icon Badge Number to My App's icon:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let badgeCount: Int = 123
let application = UIApplication.sharedApplication()
if #available(iOS 8.0, *) {
//// iOS 8, iOS 9, iOS 10
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Badge], categories: nil))
} else {
//// iOS 7
}
application.applicationIconBadgeNumber = badgeCount
application.accessibilityValue = "123 custom description."
}
}
推荐答案
它看来这是现在的仅限Apple功能...
It appears this is an "Apple-only" feature as of now... source
通过API文档挖掘,似乎没有任何可以为您设置此标识符的标识符,因此我认为它不受公开支持然而。它可能已经被报道过了,但是作为对的请求报告这一点永远不会受到伤害。
Digging through API documentation, there doesn't seem to be any identifier that can set this for you, and I therefore think it's not publicly supported yet. It's likely been reported already, but reporting this as a request to Apple can never hurt.
对不起,这可能不是您所希望的答案! :/
Sorry this is probably not the answer you were hoping for! :/
这篇关于如何将VoiceOver辅助功能添加到应用程序的图标徽章编号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!