This repository has been archived on 2025-09-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
AndroidCalculator/AndroidCalculator/ViewController.swift

41 lines
934 B
Swift

//
// ViewController.swift
// AndroidCalculator
//
// Created by Pin Lin on 2020/5/4.
// Copyright © 2020 Pin Lin. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var borderView: UIView!
@IBOutlet weak var processLabel: UILabel!
@IBOutlet weak var resultLabel: UILabel!
@IBOutlet var numberButtons: [UIButton]!
var calculator = Calculator()
@IBAction func clickButton(_ sender: UIButton) {
calculator.click(sender.currentTitle!)
updateView()
}
func updateView() {
processLabel.text = calculator.process
resultLabel.text = calculator.result
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
borderView.layer.borderWidth = 1
borderView.layer.borderColor = #colorLiteral(red: 0.8374180198, green: 0.8374378085, blue: 0.8374271393, alpha: 1)
updateView()
}
}