Use Large Text Accessibility feature in iOS app

2019-06-15 15:32发布

In iOS devices it is possible to set Large Text in the Accessibility Settings. The user can specify different font sizes here. I would like to use this font size in my app as well. I haven't found anything about accessing this font size in my app in the Accessibility Program Guide. It only mentions that the standard Apple apps Mail, Contacts, Calendars etc are using it. Does anyone know if this information is accessible when developing an app?

The static -FontSize methods of UIFont also do not return different values when the Large Text feature is set.

(NOTE: Not to be confused with iOS 7's new Dynamic Type. This is a different, older option under the Accessibility settings.)

This is what iOS 6's Large Type setting looks like.

4条回答
Ridiculous、
2楼-- · 2019-06-15 16:30

Unfortunately you can't.

Most probably because autolayout wasn't yet implemented and using a bigger font would mess up the app interface. In iOS7 as said you can support Dynamic type. But if you need to target lower iOS versions, if it is possible, is better to work around using other Accessibility features.

As far as I remember from iOS4 and higher the system offer a sort of lens to magnify areas of the screen, and it wasn't just a spring board functions but it was totally ported into apps. There is also a high contrast functions that helps visual impaired person.

Probably you can get the most of help for those people using accessibility API for text-to-speech, they work well in app but not for custom control, so you will need to implement ad-hoc behaviors fro those components.

You can create a sort of slider to set font size directly inside the app, such as iBook application.

In my opinion the best way is keep everything neat and simple, from the design process, to the implementation detail. For instance:

  • Avoid complex gestures
  • Keep interface clean
  • Avoid complex navigation
  • Avoid mutliple tableview in the same screen
  • Do not use small buttons
查看更多
三岁会撩人
3楼-- · 2019-06-15 16:31

Accessibility settings is not accessible through iOS SDK. In iOS 7, you can support Dynamic Type, which allows you to set any font to the system font in the size defined by the user by calling +preferredFontWithTextStyle:.

查看更多
在下西门庆
4楼-- · 2019-06-15 16:33

I don't think you'll get an answer here because the WWDC content is under NDA. If you have a developer account, you could have a look here https://developer.apple.com/library/prerelease/ios/releasenotes/General/iOS70APIDiffs/index.html and search for UIFont. It's the third added method.

查看更多
▲ chillily
5楼-- · 2019-06-15 16:36

It's not accessible using documented APIs.

Just for fun though: (do not use in a real app, it will probably get you rejected from the store)

It's stored under com.apple.Accessibility.plist, key preferredFontSize

MobileNotes.app (and presumably the others) get it using the function

extern float _UIAccessibilityLargeTextFontSize(float);

(it's so undocumented they made sure to start it with an underscore.)

查看更多
登录 后发表回答