gpt4 book ai didi

ios - 即使在指定 contentShape 后,ContextMenu 使用不正确的 cornerRadius

转载 作者:行者123 更新时间:2023-12-05 07:03:29 24 4
gpt4 key购买 nike

struct CardView: View {
private var name: String = "Random Name"
private var color: Color = Color.red

private var CardContent: some View {
HStack(alignment: .top) {
Text(name)
.font(.system(size: 16, weight: .medium, design: .rounded))
.frame(width: 110, height: 80, alignment: .top)
}
.padding(.top, 20)
.frame(width: 200, height: 190, alignment: .top)
.background(color)
.clipShape(RoundedRectangle(cornerRadius: 30, style: .continuous))
}

var body: some View {
CardContent
.contentShape(RoundedRectangle(cornerRadius: 30, style: .continuous))
.contextMenu {
Button(action:{}){
HStack {
Image(systemName: "trash")
.foregroundColor(Color.red)
Text("Delete")
}
}
}
.shadow(color: color.opacity(0.5), radius: 10, x: 10, y: 10)
}
}

当我长按时, View 被错误地剪裁:

enter image description here ]

另外,为什么垃圾桶图像不是红色的?

这是 ContextMexu 怪癖吗?

最佳答案

原来 iOS 13.6 模拟器有这个奇怪的人工制品使用 Xcode 12 切换到 iOS 14,问题消失。

关于ios - 即使在指定 contentShape 后,ContextMenu 使用不正确的 cornerRadius,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63190596/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com