gpt4 book ai didi

ios - 容器 View 不检查滚动中的 UITableView 数据?

转载 作者:行者123 更新时间:2023-11-30 11:29:33 24 4
gpt4 key购买 nike

我以编程方式创建了一个带有子 ViewController 的容器 View 。 subview 包含 UITableView 但我无法滚动 UITableView(如果我滚动数据隐藏在 UITableView 中)。

let VC = self.storyboard?.instantiateViewController(withIdentifier: "roomList") as! roomListViewController
VC.view.frame = CGRect(x: 0, y: 0, width: (containerView?.frame.size.width)!, height: (containerView?.frame.size.height)!)
/// self.containerView?.isHidden = false
self.containerView?.addSubview(VC.view)
let flipDirection: UIViewAnimationOptions = flipped ? .transitionFlipFromTop : .transitionFlipFromBottom
let options: UIViewAnimationOptions = [flipDirection, .showHideTransitionViews]
UIView.transition(from: VC.view, to: VC.view, duration: 0.6, options: options) {
finished in

}

最佳答案

我已经修复了 addChildViewController(VC) 和 VC.didMove(toParentViewController: self) 父方法。我的工作代码是

        let VC = self.storyboard?.instantiateViewController(withIdentifier: "roomList") as! roomListViewController
addChildViewController(VC)
VC.view.frame = CGRect(x: 0, y: 0, width: (containerView?.frame.size.width)!, height: (containerView?.frame.size.height)!)
VC.delegate = self

self.containerView?.addSubview(VC.view)
//controller.didMoveToParentViewController(self)
VC.didMove(toParentViewController: self)
let flipDirection: UIViewAnimationOptions = flipped ? .transitionFlipFromTop : .transitionFlipFromBottom
let options: UIViewAnimationOptions = [flipDirection, .showHideTransitionViews]
UIView.transition(from: VC.view, to: VC.view, duration: 0.6, options: options) {
finished in

//cardModel.flipped = !flipped
}

关于ios - 容器 View 不检查滚动中的 UITableView 数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50390763/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com