我有TableViewController文件。还有另一个swiftUI视图文件名为pictureView in swiftUI
let actionNext = UIAction(title: "Next", image: UIImage(systemName: "arrow.forward.circle.fill")) { action in
print("action next clicked")
}我想通过以下操作打开pictureView()
发布于 2022-10-24 11:20:03
不能直接在SwiftUI中使用UIKit视图。因此,您需要将其嵌入到UIHostingController中,而不是:
let pictureHostingController = UIHostingController(rootView: PictureView())
pictureHostingController.translatesAutoresizingMaskIntoConstraints = false
navigationController?.pushViewController(pictureHostingController, aniated: true)如果我正确理解你的问题,这应该是解决办法。
https://stackoverflow.com/questions/74177933
复制相似问题