如何向应用程序的图标标识号添加语音访问权限?

时间:2022-09-28 16:53:53

Question:

问题:

How do I add a custom VoiceOver accessibility Label or Hint to an App Icon Badge Number?

如何添加自定义的VoiceOver标签或提示应用程序图标徽章号码?

如何向应用程序的图标标识号添加语音访问权限?           如何向应用程序的图标标识号添加语音访问权限?           如何向应用程序的图标标识号添加语音访问权限?

                    


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:

例如,当打开iOS设置可访问性>的画外音时,画外音会读出屏幕上被触摸的项目。对于App Store和Mail图标,大声读出如下内容:

App Store icon, VoiceOver says: "App Store. 2 updates available. Double tap to open."

应用商店图标,画外音说:“应用商店。2更新可用。双击打开。”

Mail icon, VoiceOver says: "Mail. 1 unread message. Double tap to open."

邮件图标,画外音说:“邮件。1未读信息。双击打开。”

But, for the project I am working on, the VoiceOver read out is generic and not entirely helpful:

但是,对于我正在进行的这个项目来说,配音是通用的,并不是完全有用的:

My App icon, VoiceOver says: "My App. 123 new items. Double tap to open."

我的App图标,画外音说:“我的App。123新项目。”双击打开。”

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.

“…new items“太模糊了,不准确,我确信一定有办法用自定义字符串更改它,通过设置accessibilityLabel、accessibilityHint或类似的东西使它读得更好。

But how exactly in Swift code?

但是Swift码究竟是怎样的呢?

Many thanks.

多谢。


Additional observation:

额外的观察:

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."

通过使用模拟器可访问性检查器,可以看到画外音值来自标签——“我的应用”和值——“123新项目”。因此,我在代码中进行了更新,尝试将accessibilityValue设置为自定义的东西——“123自定义描述”。但是仍然没有运气,画外音继续读“我的应用123新项目”。双击打开。”

Why isn't VoiceOver reading the custom badge value as expected?

为什么画外音不像预期的那样读取自定义徽章值?

如何向应用程序的图标标识号添加语音访问权限?


Code:

代码:

The below method adds a red circle App Icon Badge Number to My App's icon:

下面的方法在我的App图标中添加了一个红圈App图标编号:

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."
    }
}

1 个解决方案

#1


5  

It appears this is an "Apple-only" feature as of now... source

目前看来,这是一个“只支持苹果”的特性……源

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.

仔细阅读API文档,似乎没有任何标识符可以为您设置它,因此我认为它还没有公开支持。这可能已经被报道过了,但向苹果公司提出这一要求永远不会有坏处。

Sorry this is probably not the answer you were hoping for! :/

对不起,这可能不是你希望的答案!:/

#1


5  

It appears this is an "Apple-only" feature as of now... source

目前看来,这是一个“只支持苹果”的特性……源

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.

仔细阅读API文档,似乎没有任何标识符可以为您设置它,因此我认为它还没有公开支持。这可能已经被报道过了,但向苹果公司提出这一要求永远不会有坏处。

Sorry this is probably not the answer you were hoping for! :/

对不起,这可能不是你希望的答案!:/