ios - ScrollView 剪切的阴影
问题描述
有没有办法可以将阴影应用于图像以显示在父视图之外?您可以在下面看到一个示例,其中我列出了 aScrollView
和HStack
. 图像/艺术品应用了阴影,但这会被ScrollView
.
ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(stationsFeed.items.sorted(by: { $0.updatedAt > $1.updatedAt }).prefix(15)) { item in
NavigationLink(destination: StationDetailView(station: item)) {
VStack(alignment: .leading) {
if item.artwork != nil {
KFImage(self.artworkURLForStation(item)!)
.resizable()
.frame(width: 130, height: 130)
.scaledToFit()
.cornerRadius(6)
.shadow(radius: 5)
} else {
RoundedRectangle(cornerRadius: 6)
.background(Color.purple)
.shadow(radius: 5)
}
Text(item.name)
.font(.callout)
.foregroundColor(.primary)
Text(item.categories.first?.name ?? "N/A")
.font(.callout)
.foregroundColor(.secondary)
}
.frame(minWidth: 0, maxWidth: 130, alignment: .leading)
}
.buttonStyle(PlainButtonStyle())
}
}
}
解决方案
推荐阅读
- javascript - 单击以在单击的位置打开 div
- java - 在 iText 7 的 html2pdf 中显示货币符号的简单方法
- sql - Oracle SQL中的查询查询
- sql-server - 如何完成推荐 - Azure 发送的“应为 SQL 服务器配置 Azure Active Directory 管理员”?
- linux - Heroku 上的 Electron 应用程序和与 libpng12.so.0 相关的错误:
- django - 在 Wagtail 中同时搜索页面和自定义模型
- javascript - 当 React js 中的任何状态发生变化时,如何停止重新渲染子组件?
- excel - 如何在不循环的情况下清除范围内货币格式的单元格
- memory - Kubernetes pod 内存使用明细
- dask - 是否可以从 Dask 读取镶木地板元数据?