子视图控制器 table 视图的最后一行不能 select
Last row on child view controller's table view cannot select
我正在尝试制作一个带有 table 视图的视图容器。这很好用,但是如果我 select 最后一行,方法 didSelectRowAt indexPath:
不能被触发。这是我的代码:
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let controller = storyboard.instantiateViewController(withIdentifier: "pageViewController") as! PageViewController
addChildViewController(controller)
controller.customDelegate = self
controller.index = index
self.controller = controller
//Add Controllers
let clientInfoVC = storyboard.instantiateViewController(withIdentifier: "ClientInfo") as! ClientInfoViewController
clientInfoVC.client = self.client
let clientRequestsVC = storyboard.instantiateViewController(withIdentifier: "ClientRequests") as! ClientProductRequestViewController
clientRequestsVC.client = self.client
let clientDebtsVC = storyboard.instantiateViewController(withIdentifier: "ClientDebts") as! ClientDebtViewController
clientDebtsVC.client = self.client
controller.orderedViewControllers = [clientInfoVC,clientRequestsVC,clientDebtsVC]
controller.view.frame = CGRect(x: 0, y: 0, width: self.clientContainerView.frame.width, height: self.clientContainerView.frame.height)
self.clientContainerView.addSubview(controller.view)
controller.didMove(toParentViewController: self)
这是我的容器视图:
我做错了什么?
请帮助我
我找到了解决方案:
我需要删除控制器的框架设置,仅此而已。所以只需删除这一行:
controller.view.frame = CGRect(x: 0, y: 0, width: self.clientContainerView.frame.width,
height: self.clientContainerView.frame.height)
我正在尝试制作一个带有 table 视图的视图容器。这很好用,但是如果我 select 最后一行,方法 didSelectRowAt indexPath:
不能被触发。这是我的代码:
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let controller = storyboard.instantiateViewController(withIdentifier: "pageViewController") as! PageViewController
addChildViewController(controller)
controller.customDelegate = self
controller.index = index
self.controller = controller
//Add Controllers
let clientInfoVC = storyboard.instantiateViewController(withIdentifier: "ClientInfo") as! ClientInfoViewController
clientInfoVC.client = self.client
let clientRequestsVC = storyboard.instantiateViewController(withIdentifier: "ClientRequests") as! ClientProductRequestViewController
clientRequestsVC.client = self.client
let clientDebtsVC = storyboard.instantiateViewController(withIdentifier: "ClientDebts") as! ClientDebtViewController
clientDebtsVC.client = self.client
controller.orderedViewControllers = [clientInfoVC,clientRequestsVC,clientDebtsVC]
controller.view.frame = CGRect(x: 0, y: 0, width: self.clientContainerView.frame.width, height: self.clientContainerView.frame.height)
self.clientContainerView.addSubview(controller.view)
controller.didMove(toParentViewController: self)
这是我的容器视图:
我做错了什么? 请帮助我
我找到了解决方案:
我需要删除控制器的框架设置,仅此而已。所以只需删除这一行:
controller.view.frame = CGRect(x: 0, y: 0, width: self.clientContainerView.frame.width,
height: self.clientContainerView.frame.height)