ios辅助功能

This blog was inspired by Jeff Watkins’ series of blogs on UIButton. UIButton is a fundamental part of building interfaces on iOS. So much so, that it probably doesn’t get the love it deserves. But it’s also really powerful and customisable when used correctly.

该博客的灵感来自Jeff Watkins在UIButton上的 一系列 博客 。 UIButton是在iOS上构建界面的基本部分。 如此之多,以至于它可能无法得到应有的爱。 但是,如果使用正确,它也确实非常强大且可自定义。

Accessibility labels on iOS I feel are very similar. They’re fundamental to how accessibility works on iOS, yet I think they suffer from a few PR issues. Firstly, Apple has done such a good job with them that we often don’t give the humble accessibility label the consideration it deserves, instead relying on the Apple default behaviour. Secondly, they’re just some text, right? Who can get excited about just a boring old label? Well, I’m sure this won’t surprise you, but I can.

我觉得iOS上的辅助功能标签非常相似。 它们是可访问性在iOS上如何工作的基础,但是我认为它们存在一些PR问题。 首先,苹果公司在他们身上做得非常好,以至于我们经常不给不起眼的可访问性标签以应有的重视,而是依靠苹果公司的默认行为。 其次,它们只是一些文字,对不对? 谁会为一个无聊的老唱片而兴奋? 好吧,我相信这不会令您感到惊讶,但是我可以。

什么是辅助功能标签? (What’s an Accessibility Label?)

When iOS presents your app’s interface to assistive technologies such as VoiceOver, Voice Control or Switch Control, it’s not passing your app’s screen, but a representation of the screen in what’s known as an accessibility tree, or accessible user interface as Apple often call it. Your customer’s chosen assistive technology will then handle how to present your interface in the way that best suits your customer. But assistive technologies need something to present, and their first port of call is your element’s accessibility label. VoiceOver will read it, braille displays will display it, and Voice Control will listen for it.

当iOS将您的应用程序界面显示为VoiceOver,Voice Control或Switch Control等辅助技术时,它不会通过您的应用程序屏幕,而是通过所谓的可访问性树或Apple经常称为的可访问用户界面来表示屏幕。 然后,客户选择的辅助技术将处理如何以最适合客户的方式显示界面。 但是辅助技术需要呈现一些东西,而它们的第一个调用端口是元素的可访问性标签。 VoiceOver会朗读它,盲文显示器将显示它,而Voice Control会监听它。

它只是工作 (It Just Works)

Here’s the first cool thing about accessibility labels on iOS. You don’t need to think about them. All of iOS’ inbuilt controls will work out what their accessibility label is from the content you’ve given it. Mostly this will be the control’s text value. Set this and you’re done.

这是关于iOS上的辅助功能标签的第一件事。 您无需考虑它们。 所有iOS内置控件都将根据您提供的内容确定其可访问性标签是什么。 通常,这将是控件的text值。 设置这个就可以了。

I’m not letting you get out of this post that easily though. Because although this behaviour is great, don’t think this absolves you of your responsibility for accessibility in your app. Most of the time this behaviour is fine, but why settle for fine when you make your app’s experience awesome?

不过,我不会轻易让您离开这篇文章。 因为尽管这种行为很好,但不要认为这免除了您对应用程序中可访问性的责任。 在大多数情况下,这种行为是可以的,但是当您使应用程序的体验变得很棒时,为什么还要满足呢?

自行设定 (Setting Your Own)

Sometimes you’ll need to specify an accessibility label yourself instead of relying on iOS to figure this out for you. Fortunately, doing that is just as simple as setting a text value. In code, you set the element’s accessibilityLabel property in UIKit, for SwiftUI use the .accessibility(label: )modifier. And in Interface Builder look out for the Accessibility section in the Identity Inspector pane.

有时,您需要自己指定一个可访问性标签,而不是依靠iOS来为您解决此问题。 幸运的是,这样做就像设置text值一样简单。 在代码中,您accessibilityLabel在UIKit中设置元素的accessibilityLabel属性,对于SwiftUI,请使用.accessibility(label: )修饰符。 在Interface Builder中,在Identity Inspector窗格中查找Accessibility部分。

// Setting an accessibility label to 'My accessibility label' in UIKitmyButton.accessibilityLabel = "My accessibility label"// Setting an accessibility label to 'My accessibility label' in SwiftUIButton(action: {}) {    Text("Button")}.accessibility(label: Text("My accessibility label"))

It’s important to remember that assistive technologies will only pick up your accessibility label if the element is visible to them. Again, Apple has made some sensible default choices on their UI elements for this value, but if you need to set an element to be visible or hidden to accessibility use the Accessibility Enabled checkbox in the screenshot above. Or for UIKit, isAccessibilityElement and the .accessibility(hidden: ) modifier in SwiftUI, both of these take a Boolean argument.

重要的是要记住,辅助技术只有在元素对他们可见的情况下才会出现。 同样,Apple在其UI元素上为此值做出了一些明智的默认选择,但是如果您需要将元素设置为可见或隐藏以显示可访问性,请使用上面的屏幕快照中的“已启用可访问性”复选框。 对于UIKit,在.accessibility(hidden: )isAccessibilityElement.accessibility(hidden: ) :)修饰符都采用布尔参数。

// Hiding an image to assistive technologies in SwiftUIImage("Image")    .accessibility(hidden: true)// Revealing an image to assistive technologies in UIKitmyImage.isAccessibilityElement = true

下一个 (Next Up)

The next blog in this series is When to use Accessibility Labels

本系列的下一个博客是何时使用辅助功能标签

  • iOS Accessibility Labels

    iOS辅助功能标签

  • When to use Accessibility Labels

    何时使用辅助功能标签

  • Writing Great iOS Accessibility Labels

    编写出色的iOS无障碍标签

  • iOS Attributed Accessibility Labels

    iOS属性可访问性标签

This post was originally published on mobilea11y.com. Visit Mobile A11y for more mobile accessibility tools and techniques.

该帖子最初发布在mobilea11y.com上 。 访问Mobile A11y,以获取更多的移动辅助工具和技术。

翻译自: https://medium.com/macoclock/ios-accessibility-labels-28f18aa5e082

ios辅助功能


http://www.taodudu.cc/news/show-6433540.html

相关文章:

  • canvas.drawArc
  • android Canvas OpenGLES
  • GameCanvas类
  • Chrome 113 发布,默认启用 WebGPU
  • Android Canvas Layers
  • 示例:在H5中使用video结合canvas来录制视频和上传
  • 分享十个前端Web3D可视化框架附地址
  • 计算机手绘图软件,openCanvas
  • 安卓Canvas
  • Android Canvas类
  • 三种前端实现VR全景看房的方案,收藏吧说不定哪天就用得上
  • 渠道信息系统
  • 【鸿蒙】鸿蒙操作系统应用开发入门级初体验
  • 脉诊在现代医学中的应用与局限性
  • 【大数据入门核心技术-HBase】(七)HBase Python API 操作
  • 国脉科技股份有限公司
  • CRM系统五大技巧集成Excel为销售流程赋能
  • SaaSBase:微宏科技是什么?
  • 【大数据入门核心技术-Hbase】(一)HBase简介
  • 大数据技术——HBase简介
  • 【大数据入门核心技术-HBase】(八)Phoenix简介
  • 销售管理系统哪种好?
  • 【大数据入门核心技术-HBase】(十)Hbase结合Phoenix的使用
  • Python使用Cv2模块识别验证码
  • Python识别验证码----数美图标点选
  • playwright--登录识别验证码实例
  • Node识别验证码
  • 量子OFFICE:呼吁制定字体斜体的国家标准
  • yii2 advanced 开启gii localhost/index.php?r=gii无法打开gii
  • yii2 gii生成curd

ios辅助功能_iOS辅助功能标签相关推荐

  1. ios html正则表达式,ios 正则表达式去html标签

    ios 正则表达式去html标签 [2021-01-27 12:53:55]  简介: php正则表达式去掉html的方法:首先使用"htmlspecialchars_decode" ...

  2. IOS系统中input标签获取焦点页面会放大的问题

    IOS系统中input标签获取焦点页面会放大的问题 在iOS系统中打开网页,input框输入时,输入框获取焦点的时候页面会放大,如果没有经过设置,页面放大之后就不会自动还原.使内容撑开浏览器,底部产生 ...

  3. android 辅助功能_辅助功能简介

    android 辅助功能 Accessibility may be more than a moral imperative to ensure products are inclusive of m ...

  4. php接收不到ios值,php设置标签后,ios收不到,安卓可以收到

    通过下面代码设置的标签: $client->device()->addTags($registration_id, 'test'); 通过下面代码推送的消息 $result = self: ...

  5. iOS NFC开发(读标签与写标签)

    #一.说明 1-苹果手机从iPhone6开始装有NFC硬件,但并未对第三方应用开放.因此iPhone6及iPhone6s不能识别NFC标签,但是可以使用系统NFC功能如:刷地铁. 2-苹果从iOS11 ...

  6. mysql ios 工具_IOS工具(三)安装mysql

    @[TOC](Mac 安装mysql) 1. 下载安装包 官网 点击这里下载mysql,点击"Community"标签下会看到"MySQL Community Serve ...

  7. java ios压缩_iOS与Java服务器GZip压缩问题【转】

    昨天搞了一天的GZip压缩,试了三种方式(libz库,ZipArchive,ASIHttpRequest),一开始都不成功. 理论上三个应该都能用的,但我都不行.等我试到第三种方式的时候才知道,不是我 ...

  8. android label关闭按钮,iOS弹出关闭按钮标签:“OK”还是“Okay”?

    I'm working on an iPhone app with custom popup alerts. In the design these alerts all have "Can ...

  9. ios 微信端 video 标签 兼容问题

    已经证明好用的方法 引用微信jssdk <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js">< ...

最新文章

  1. eclipse提示在***类中找不到main方法
  2. Qtum 量子链首例太空节点交易完成
  3. 相互靠近的色环电感之间的互感
  4. java里css查找快捷键_CSS入门2—元素快捷键
  5. Selenium Webdriver概述(转)
  6. P6139-[模板]广义后缀自动机(广义 SAM)
  7. C语言进阶——全局变量
  8. Windows远程文件拷贝openEuler--WinSCP
  9. 解一元一次方程的那些坑(记洛谷P1022题RE的经历,Java语言描述)
  10. 用注解给映射视图的类创建联合主键
  11. HTML5按键打开摄像头和拍照
  12. 彻底理解AMD和CMD
  13. sql server 查询某个表被哪些存储过程调用
  14. 兴奋:支持安卓(android)、苹果手机和平板电脑的WayOs版本
  15. Qt配置使用VS2010进行开发
  16. Docker与容器化-01-Docker简介及Docker在CentOS7环境下安装
  17. 不用软件直接查询QQ好友的IP地址(二) 通过 Ping 得知对方是否联网在线(与QQ是否上线无关)
  18. 无法退休的董小姐?董明珠继任格力董事长
  19. wp网站,wordpress网站搭建,wp网站建设教程
  20. 天还是那个天,从前却不再是那个从前

热门文章

  1. 山东大学软件学院概率论与数理统计
  2. 小程序开发API之获取收货地址wx.chooseAddress
  3. 易语言对接第三方验证码短信接口demo
  4. java之字符串--回文字符串
  5. 牛粪就要插鲜花――一个大龄博士的征婚宣言
  6. [转帖]Linux查找文件6个高效工具
  7. 关于stdlib头文件
  8. c语言 字节某位取反 amp;=,C语言位运算
  9. cannot coerce class ‘“igraph“’ to a data.frame
  10. 山西大学计算机专业国内排名,山西这所大学曾是国内排名前五,如今排名下滑,有点走下坡路了...