大多数浏览器和
Developer App 均支持流媒体播放。
-
构建支持多语言的 App
确保你的 App 能够正常、高效地满足多语言用户的需求。学习有关文本输入、显示、搜索和格式设置的推荐做法。详细了解如何提供无需更换键盘的多语言输入体验。此外,探索 String Catalog 的最新改进如何帮你更轻松地实现本地化。
章节
- 0:00 - Introduction
- 2:24 - Input
- 8:08 - Display
- 11:01 - Localization
- 16:07 - Wrap-up
资源
相关视频
WWDC24
WWDC23
WWDC21
WWDC20
-
下载Array
-
-
3:18 - Specify textInputContextIdentifier
override var textInputContextIdentifier: String? { uniqueID }
-
3:41 - Place a view directly above the keyboard
textView.inputAccessoryView = viewAboveKeyboard
-
4:00 - Use keyboardLayoutGuide to adapt to keyboard
view.keyboardLayoutGuide.topAnchor.constraint(equalToSystemSpacingBelow: textView.bottomAnchor, multiplier: 1.0).isActive = true
-
4:42 - Check for marked text before modifying
if textView.markedTextRange.empty { // Perform actions involving editing text }
-
5:58 - Use localizedStandardRange when searching
let range = text.localizedStandardRange(of: search)
-
7:24 - Use color differences to highlight text
attributedString[range].foregroundColor = highlightColor
-
9:39 - Text Styles
// Text Styles // SwiftUI Text("Hello, world!") // uses .body Text Style by default Text("Hello, world!").font(.title) // UIKit let label = UILabel() label.text = "Hello, world!" label.font = UIFont.preferredFont(forTextStyle: .body) // AppKit let textField = NSTextField(labelWithString: "Hello, world!") textField.font = NSFont.preferredFont(forTextStyle: .body) // Keep clipsToBounds off clipsToBounds = false
-
10:03 - Typesetting language
// Typesetting language // SwiftUI Text(verbatim: "Hello, world!").typesettingLanguage(.init(languageCode: .english)) // UIKit let label = UILabel() label.text = "Hello, world!" label.traitOverrides.typesettingLanguage = Locale.Language(languageCode: .english)
-
10:29 - Formatting names
// Formatting names let nameComponents = PersonNameComponents (givenName: "瑗珺", familyName: "汪", nickname: "珺珺") // Short Name (respects settings like “Prefer Nicknames”) let shortName = nameComponents.formatted(.name(style: .short)) // 珺珺 // Abbreviated Name (can be used for monograms) let monogram = nameComponents.formatted(.name(style: .abbreviated)) // 汪
-
12:20 - Examples of personalizing text
"^[Nuestro %@](inflect: true) está ^[hecho](agreeWithArgument: 1) de %@." "अगर आप पहुँच नहीं ^[पाते हैं](inflect: true)" "예: ‘^[%@을](inflect: true) 켤 때’"
-
13:43 - Format numbers using Text
Text("\(numberOfDays)-day forecast")
-
14:21 - Format numbers using AttributedString
AttributedString(localized: "10-day forecast") AttributedString(localized: "0.5× zoom")
-
15:23 - Launch to your app’s settings
// Launch to your app’s settings if let url = URL(string: UIApplication.openSettingsURLString) { await UIApplication.shared.open(url) }
-
-
正在查找特定内容?在上方输入一个主题,就能直接跳转到相应的精彩内容。
提交你查询的内容时出现错误。请检查互联网连接,然后再试一次。