You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here are the changes to PresentedViewController which I described above.
Look for blocks of code marked with a // new code comment.
classPresentedViewController:UIViewController{privatevarnotificationToken:NotificationToken!@IBOutlet weak varpresentedView:PresentedView!@IBOutlet weak vartableView:UITableView!// new code@IBActionfunc dismissButtonTapped(){dismiss(animated: true)}overridefunc viewDidLoad(){
super.viewDidLoad()// new code
tableView.delegate =self
tableView.dataSource =self// --------self.notificationToken =NotificationCenter.default
.addObserver(name:DrawerNotification.drawerExteriorTappedNotification){(notification:DrawerNotification, object:Any?)in
switch notification {case.drawerExteriorTapped:print("drawerExteriorTapped")default:
break
}}}@IBActionfunc unwindFromModal(with segue:UIStoryboardSegue){}}// new codeextensionPresentedViewController:UITableViewDataSource{func tableView(_ tableView:UITableView, numberOfRowsInSection section:Int)->Int{return10}func tableView(_ tableView:UITableView, cellForRowAt indexPath:IndexPath)->UITableViewCell{// Generally, one should dequeue cells rather than create a new one every time this// function is called but, for this quick test, it's ok to do it this way.letcell=UITableViewCell(style:.default, reuseIdentifier:nil)
cell.textLabel?.text ="Row \(indexPath.row +1)"return cell
}}extensionPresentedViewController:UITableViewDelegate{func tableView(_ tableView:UITableView, didSelectRowAt indexPath:IndexPath){
tableView.deselectRow(at: indexPath, animated: true)print("Selected row: \(indexPath.row +1)")}}// -------
I've added UITableView to presented UIViewController, but when presented the delegate method didSelectRowAt doesn't called when i tap on row.
i have tried reenable userInteraction on table on ViewWillAppear method of presented VC.
The text was updated successfully, but these errors were encountered: