swift - SwiftUI 标题字体
问题描述
我正在尝试找到一种获取List
' 标题的系统字体的好方法。这就是我的意思:
struct ContentView: View {
var body: some View {
List {
Section(header: Text("Test")) {
Text("Blablabla")
}
}
}
}
基本上,有没有办法以编程方式获取图像中显示“测试”的文本的字体,所以我可以在Text
对象的其他地方使用它?
我是尝试通过使用来制作可折叠标题DisclosureGroup
的字体,但是 的字体DisclosureGroup
与Section
.
解决方案
另一种方法是给出你想要的字体,然后在你想要的任何地方使用它,很有趣:
Text("Test").font(.largeTitle)
Text("Test").font(.system(size:34))
Text("Test").font(.system(size: 20, weight: .bold, design: .serif)))
Text("Test").font(Font.custom("Wingdings", size: 30.0))
Text("Test").font(Font.custom("Montserrat-Bold", size: 30.0))
推荐阅读
- spring - 为什么一些相关实体没有序列化为 JSON?
- c++ - 从用户输入中解析令牌的良好做法是什么?
- php - oAuth 1.0 REST API 与 Magento 1.9,如何像邮递员一样获得 oauth_signature?
- .net - .NET CORE 2.1 中的 CORS - 简单配置不返回标头
- javascript - 我在这段代码中做错了什么 - 反转字符串?
- azure-machine-learning-studio - Score Matchbox Recommender 卡住或抛出错误
- python - 在 pytorch 中为 ASR 加载 librispeech
- python - Pandas group by 正在放弃分组的维度
- python - 增加 n_jobs 对 GridSearchCV 没有影响
- protractor - 将 CTRL+SHIFT+R 发送到量角器中的网页