[英]How to add onTapGesture AND underline to specific word in a SwiftUI Text view?
[英]SwiftUI how to add an Underline to a Text View?
有沒有辦法修改文本視圖以具有下划線? 例如像下面這樣的文字:
y͟o͟u͟r͟ t͟e͟x͟t͟
Text(Constants.chooseText)
.font(Font.system(size: 26))
.foregroundColor(Color.white)
.padding(.bottom, 80)
在文本視圖上添加下划線修飾符
Text("Hello, world!")
.underline()
UPDATE 添加 underline() 作為第一個修飾符解決了這個問題。
Text(Constants.chooseText)
.underline()
.font(Font.system(size: 26))
.foregroundColor(Color.white)
.padding(.bottom, 80)
您可以像下面這樣使用:
Text("Forget User ID")
.underline(true, color: .gray)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.