如何用黑色繪制完全灰色的空間?看圖片
這是我的代碼:
.onTapGesture {
self.showModal = true
}.sheet(isPresented: self.$showModal, onDismiss: {
// addEntry()
// requestReviewIfNeeded()
self.showModal = false
}, content: {
BiographyDetail(biography: self.biography)
Button(action: {
showModal = false
}) {
Text("CLOSE")
.foregroundColor(.gray)
.background(Color.black).ignoresSafeArea()
}
})
感謝任何幫助!
uj5u.com熱心網友回復:
這是一種可能的方法 - 使用顏色作為背景并將特定內容放入此顏色的疊加層中。
使用 Xcode 13 / iOS 15 測驗
.sheet(isPresented: $showModal) {
Color.black
.ignoresSafeArea() // << consumes all space
.overlay( // << content is overlaid
VStack(spacing: 0) {
BiographyDetail(biography: self.biography)
Button(action: {
showModal = false
}) {
Text("CLOSE")
.foregroundColor(.gray)
.background(Color.black).ignoresSafeArea()
}
})
}
uj5u.com熱心網友回復:
添加框架到 Text
Text("CLOSE")
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.foregroundColor(.gray)
.background(Color.black).ignoresSafeArea()
uj5u.com熱心網友回復:
Text("CLOSE") .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity) .foregroundColor(.gray) .background(Color.black).ignoresSafeArea()
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/341002.html
上一篇:如何將影像更改為結構?用戶界面
下一篇:如何找到一列的總和?
