ios - How to switch view controllers in swift? -
i'm trying switch 1 uiviewcontroller using code. right have,
self.presentviewcontroller(resultviewcontroller(), animated: true, completion: nil) all doing taking me black screen instead of resultviewcontroller. suggestions?
with storyboard. create swift file (secondviewcontroller.swift) second view controller , in appropriate function type this:
let secondviewcontroller = self.storyboard?.instantiateviewcontroller(withidentifier: "secondviewcontroller") as! secondviewcontroller self.navigationcontroller.pushviewcontroller(secondviewcontroller, animated: true) without storyboard
let secondviewcontroller = viewcontroller(nibnameornil: nibname, bundleornil: nil) self.presentviewcontroller(secondviewcontroller, animated: true, completion: nil)
Comments
Post a Comment