uiscrollview - 滚动视图上的.sheet .ontapgesture 不工作swiftui
问题描述
不幸的是,它不起作用。当我点击其中一个单元格时,它什么也不做。我.sheet
在外面ScrollView
ScrollView(.vertical, showsIndicators: true) {
VStack(spacing: 0) {
ForEach(service.authorPost, id: \.author_id) { post in
AuthorListElementView(authorPost: post)
.onTapGesture {
self.shown.toggle()
self.selectedAuthor = post
}
.onAppear {
self.service.loadMoreContentIfNeeded(currentItem: post)
}
}
}
if service.isLoadingPage {
ProgressView()
.padding()
.offset(x: UIScreen.main.bounds.width / 3)
}
}
.sheet(isPresented: self.$shown, content: { PopupAuthorView(authorPost: selectedAuthor)})
解决方案
因为我在 AuthorListElement 中有另一个 .onTapGesture。当我删除 AuthorListElement 中的那个时,它起作用了。
推荐阅读
- sql - 使用 SQL 和 R 从 power BI pbix 文件中提取数据
- sql-server - 无法通过查询选择表,即使它完全可用
- python - Python - Glob 递归地挖掘目录
- apache-kafka - 卡夫卡流。在窗口宽限期关闭后获取每个键的按时间排序的事件流
- node.js - AWS Lambda Node.js 12.x 强制退出
- php - Prestashop 变量 - 类别页面
- .net-core - 无法加载 NetNamedPipeBending
- perl - Perl 如何使用 DBIx::Class 漂亮地返回数据
- python - Django:在 model.objects.filter.update() 中添加
- wso2is - WSO2 AD LDAP 在安装新证书时创建新的 wso2carbon.jks 密钥库后中断