FicowShen / Ficow_Blog_Comments

Comments of Ficow Shen's Blog (blog.ficow.cn)
0 stars 0 forks source link

iOS Dynamic Type 实战总结 #5

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

iOS Dynamic Type 实战总结 - Ficow Shen's Blog

https://blog.ficowshen.com/page/post/66

Janlor commented 2 years ago

限制动态缩放字体的字号 这个在 iOS 15+ Apple 提供了新的 API 可以处理,iOS 15 以下还是不好弄,辅助功能中的更大字体好难适配。 /// limit the support content size categories between .medium and .accessibilityExtraLarge (included). /// view.minimumContentSizeCategory = UIContentSizeCategoryMedium; /// view.maximumContentSizeCategory = UIContentSizeCategoryAccessibilityExtraLarge; @available(iOS 15.0, *) open var minimumContentSizeCategory: UIContentSizeCategory?

@available(iOS 15.0, *)
open var maximumContentSizeCategory: UIContentSizeCategory?
FicowShen commented 2 years ago

看起来,这个属性像是 Apple 专门为 SwiftUI 开发的 😂

这篇文章里面还介绍了 SwiftUI 中的用法: https://useyourloaf.com/blog/restricting-dynamic-type-sizes/