[英]How to achieve ios blur background with roundedrectangle()?
您可以使用更簡單的代碼來實現這一點。 您的代碼不起作用,因為您的RoundedRectangle
最初包含黑色作為其foreground
。
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack {
Color.pink.ignoresSafeArea(.all)
RoundedRectangle(cornerRadius: 20)
.fill(.ultraThinMaterial)
.frame(width: 200, height: 200)
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.