---
title: "Discussion on \"SwiftUI自定义边框小纸条\" | Hashnode"
description: "Discussion on \"SwiftUI自定义边框小纸条\". 在SwiftUI中可以为Text、Image、Label加上边框，方法很多，这里记录几种。\n使用border\nLabel(\"你是不是我最疼爱的人\", systemImage: \"heart.fill\")\n    .font(.largeTitle)\n    .padding()\n    .border(Color.blue, width: 5)\n这样你就得到了一个方方正正的边框\n\n如果我们想让边框是圆角的怎么做呢？\n使用background&stroke\n以下是不同的方案，结果都是这样的\n\nLa..."
url: "https://hashnode.com/posts/swiftui-custom-border/6212d9599ae0e67b657b94da"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [SwiftUI自定义边框小纸条](https://blog.hdcola.org/swiftui-custom-border?utm_source=hashnode&utm_medium=feed)

在SwiftUI中可以为Text、Image、Label加上边框，方法很多，这里记录几种。 使用border Label("你是不是我最疼爱的人", systemImage: "heart.fill") .font(.largeTitle) .padding() .border(Color.blue, width: 5) 这样你就得到了一个方方正正的边框 如果我们想让边框是圆角的怎么做呢？ 使用background&stroke 以下是不同的方案，结果都是这样的 La...

Feb 21, 2022 · 1 min read · blog.hdcola.org  
Read the article

-   [#swift](https://hashnode.com/tag/swift)
-   [#ios-app-development](https://hashnode.com/tag/ios-app-development)

## Written by

[老房东](https://hashnode.com/@hdcola)

@hdcola · Quebec CA

  
[View profile](https://hashnode.com/@hdcola)

Let's enjoy life

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
