Accessible time labels on iOS

前提是你 提交于 2019-12-01 02:37:31

NSDateFormatter has a method called localizedStringFromDate:dateStyle:timeStyle: that handles the localization automatically. Pass it a date and NSDateFormatterStyles for each the date and time portions. Note that you may want different styles for the date and time if you want something that reads nicely with voiceover. NSDateFormatterLongStyle works well for the date in most cases (as you get the month fully spelled out), while NSDateFormatterShortStyle works well for the time (as it doesn't include seconds).

More information: https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/Reference/Reference.html#//apple_ref/occ/clm/NSDateFormatter/localizedStringFromDate:dateStyle:timeStyle:

Dates and numbers must be well formatted to be perfectly understood by the VoiceOver users.

Use the following elements below and take a look at some code snippets (Objc + Swift) to figure out how to implement an impeccable read out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!