Sunday, 29 October 2017

present(open) another view in viewDidLoad

If you are doing this in your very first view. you will have problem, because the system haven't setup everything. e.g. screen size etc.

you have to do this in viewDidAppear.


    override func viewDidAppear(_ animated: Bool) {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let secondViewController = storyboard.instantiateViewController(withIdentifier: "webviewController")
        self.present(secondViewController, animated: true, completion: nil)

    }

No comments:

Post a comment