[英]swiftUI contextMenu has unwanted blurred background
I had a the following code using SwiftUI contextMenu.我使用 SwiftUI contextMenu 有以下代码。
ForEach(...) { ... in
NavigationLink(destination: SomeView()) {
HStack {
Image(...)
Text(...)
}
}
.contextMenu(ContextMenu(menuItems: { Button(...) }
The expected behaviour is image below.预期的行为如下图所示。
But at 80% of the time, the contextMenu has an UNWANTED blurred background like below.但在 80% 的情况下,contextMenu 有一个不需要的模糊背景,如下所示。 As it has been applied a weird blurred effect on top of it.
因为它在上面应用了一种奇怪的模糊效果。
Anyone knows what caused the issue?有谁知道是什么导致了这个问题?
The blur is because your button is highlighted.模糊是因为您的按钮被突出显示。 I'm facing a similar issue.
我面临着类似的问题。
By the way, simply add this before .contextMenu { }
to make it rounded顺便说一句,只需在
.contextMenu { }
之前添加它即可使其四舍五入
.contentShape(RoundedRectangle(cornerRadius: ...))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.