Created
November 6, 2021 19:24
-
-
Save richardwei6/2fdaf1598e6e236f19ce2009ec27d8ff to your computer and use it in GitHub Desktop.
Coding Club Workshop 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Page2.swift | |
// iOSWorkshop | |
// | |
// Created by Richard Wei on 11/6/21. | |
// | |
import Foundation | |
import UIKit | |
class page2ViewController: UIViewController{ | |
override func viewDidLoad() { | |
super.viewDidLoad(); | |
self.view.backgroundColor = .orange; | |
// | |
let buttonFrame = CGRect(x: 100, y: 100, width: 100, height: 100); | |
let button = UIButton(frame: buttonFrame); | |
button.backgroundColor = .red; | |
button.addTarget(self, action: #selector(self.dismissViewController), for: .touchUpInside); | |
self.view.addSubview(button); | |
} | |
@objc func dismissViewController(button: UIButton){ | |
self.dismiss(animated: true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment