[Swift] App 화면 이동

sk y·2022년 2월 4일
0

App 내에서 화면 버튼 클릭시 화면 이동

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var TestButton: UIButton!
    
    @IBAction func doSomething(_ sender: Any) {
        TestButton.backgroundColor = .orange
        let stroyboard = UIStoryboard(name: "Main", bundle: nil)
        let detailVC =  stroyboard.instantiateViewController(identifier: "DetailViewController") as DetailViewController
        
        self.present(detailVC, animated: true, completion: nil)
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        TestButton.backgroundColor = UIColor.red
        
    }
}
profile
incipience

0개의 댓글