这是我的链接:
Link("Terms + Conditions", destination: URL(string: "https://my.app/terms_and_conditions.html")!)
Run Code Online (Sandbox Code Playgroud)
我知道它Text()有一个underline()修饰符,但似乎没有一个用于Link().
任何的想法?
Link 有一个带标签参数的初始化器:
init(destination: URL, label: () -> Label)
因此,对于您的示例,您需要将Text("Terms + Conditions")视图设置为标签,并.underline()在文本视图上使用修饰符来获得预期的结果。
以苹果网站为例:
Link(destination: URL(string: "https://www.apple.com")!, label: {
Text("Apple")
.underline()
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
493 次 |
| 最近记录: |