Skip to content

Instantly share code, notes, and snippets.

@richardwei6
Created November 6, 2021 19:24
Show Gist options
  • Save richardwei6/2fdaf1598e6e236f19ce2009ec27d8ff to your computer and use it in GitHub Desktop.
Save richardwei6/2fdaf1598e6e236f19ce2009ec27d8ff to your computer and use it in GitHub Desktop.
Coding Club Workshop 2
//
// 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