꼼꼼한 재은씨의 스위프트 swift 기본편 화면전환



//

//  ViewController.swift

//  Scene-Trans02

//

//  Created by stayfoolish on 27/10/2018.

//  Copyright © 2018 stayfoolish. All rights reserved.

//


import UIKit


class ViewController: UIViewController {


    override func viewDidLoad() {

        super.viewDidLoad()

        // Do any additional setup after loading the view, typically from a nib.

    }


    override func didReceiveMemoryWarning() {

        super.didReceiveMemoryWarning()

        // Dispose of any resources that can be recreated.

    }


    @IBAction func moveByNavi(_ sender: UIBarButtonItem) {

        guard let uvc = self.storyboard?.instantiateViewController(withIdentifier: "SecondVC")else {

            return

        }

        self.navigationController?.pushViewController(uvc, animated: true)

    }

    

    @IBAction func movePresent(_ sender: UIButton) {

        guard let uvc = self.storyboard?.instantiateViewController(withIdentifier: "SecondVC") else {

            return

        }

        self.present(uvc,animated: true)

    }

}



//

//  SecondViewController.swift

//  Scene-Trans02

//

//  Created by stayfoolish on 27/10/2018.

//  Copyright © 2018 stayfoolish. All rights reserved.

//


import UIKit


class SecondViewController: UIViewController {


    override func viewDidLoad() {

        super.viewDidLoad()


        // Do any additional setup after loading the view.

    }


    override func didReceiveMemoryWarning() {

        super.didReceiveMemoryWarning()

        // Dispose of any resources that can be recreated.

    }

    

    @IBAction func back(_ sender: UIButton) {

        self.presentingViewController?.dismiss(animated: true)

    }

    

    @IBAction func Back2(_ sender: UIButton) {

        self.navigationController?.popViewController(animated: true)

    }

    /*

    // MARK: - Navigation


    // In a storyboard-based application, you will often want to do a little preparation before navigation

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

        // Get the new view controller using segue.destinationViewController.

        // Pass the selected object to the new view controller.

    }

    */


}







+ Recent posts