按XIB中的按钮打开VC

时间:2017-06-04 15:40:33

标签: swift xib viewcontroller

请帮帮我。 有一个带标记的地图,点击它们会显示一个XIB = UIVIew,里面有一个按钮,你需要点击按钮打开viewController

2 个答案:

答案 0 :(得分:0)

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "MarkerVC")
self.navigationController?.pushViewController(vc, animated: true)

答案 1 :(得分:0)

let viewController = YourViewController(nibName: "YourViewController", bundle: nil)
self.present(viewController, animated: true, completion: nil)

如果VC来自XIB,请使用上面的内容。