Navigate from a ViewController to an another on didSelectRowAt programmatically

后端 未结 3 1010
傲寒
傲寒 2021-01-27 17:12

I have a UIViewController that contains a custom UITableView. The table has a custom UITableViewCell too.

How to navigate from the

3条回答
  •  梦如初夏
    2021-01-27 17:58

    UIKit Programmatically TableCell Navigate without storyboard. you have two ways to View next viewController

    1. If you want to present .......

    animating from bottom to top

    yourTableView.deselectRow(at: indexPath, animated: true)//used for single Tap
    let vC = YourViewController (nibName: "" , bundle : nil)
            vC.modalPresentationStyle = .fullScreen //this line is optional for fullscreen
            self.present(vC, animated: true , completion: nil)
    
    1. Or if you want to View your viewController normally (2 is batter) ....

    animate from right to left

    yourTableView.deselectRow(at: indexPath, animated: true)
    let vC = YourViewController()
    self.navigationController?.pushViewController(vC, animated: true)
    

提交回复
热议问题