swift - 在 SwiftUI 中展开时,NSOutlineView 不会改变高度
问题描述
我用 NSViewRepresentable 包装了一个 NSOutlineView,效果很好。问题是当一个项目展开时,大纲视图不会改变高度并且动画不能正常工作(见下面的 gif)。当我将大纲视图放在 NSScrollView 中时,它可以正常工作,但我需要能够在单个 SwiftUI 滚动视图中放置多个大纲视图。
struct Test: View {
var body: some View {
ScrollView {
SwiftUiOutline()
// Ultimately I need multiple outline views here
}
}
}
struct SwiftUiOutline: NSViewRepresentable {
func makeNSView(context: Context) -> NSOutlineView {
let view = NSOutlineView()
// Outline view is set up here, and connected to the coordinator delegate
return view
}
class Coordinator: CustomOutlineViewController {
// The coordinator handles all the outline view delegation, etc.
}
// ...
}
问题:
它应该如何工作:
任何帮助,将不胜感激!
解决方案
推荐阅读
- jquery - 导航栏隐藏和显示在小屏幕上的切换会弄乱大屏幕
- python - 预测不相关数据的张量流神经网络模型
- javascript - 如何在 sagas 中测试多个 takeEvery?
- android - 在列表视图中交替颜色,但需要有一个起始颜色
- python - 使用python在文本中搜索字符串
- mysql - 根据表 2 中的单列返回表 1 的值
- json - ConvertFrom-Json : 传入的对象无效,应为 ':' 或 '}'
- android - 使用 FrameLayout 时 TextInputLayout 文本标题消失了
- python - 合并请求中的冗余参数
- node.js - Express 消息 '!=' 在 Pug 中引发错误