我试图访问IndexPath
所选单元格的UITableView
,但它不在同一个ViewController
中。我怎样才能做到这一点?
func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {
mainTable.selectRow(at: indexPath, animated: true, scrollPosition: UITableViewScrollPosition.none)
let popController = UIStoryboard(name: "Maina", bundle: nil).instantiateViewController(withIdentifier: "popoverId") as! SidePopOverViewController
popController.modalPresentationStyle = UIModalPresentationStyle.popover
popController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.left
popController.popoverPresentationController?.delegate = self
popController.popoverPresentationController?.sourceView = mainTable.cellForRow(at: mainTable.indexPathForSelectedRow!)
popController.popoverPresentationController?.sourceRect = (mainTable.cellForRow(at: mainTable.indexPathForSelectedRow!)!.bounds)
self.present(popController, animated: true, completion: nil)
}
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.none
}