把原本 formula 改名成 process
This commit is contained in:
@@ -246,7 +246,7 @@
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="borderView" destination="srp-dc-mcA" id="ETm-Yj-q7C"/>
|
||||
<outlet property="formulaLabel" destination="hBk-3O-ze9" id="dZb-Wh-Z9j"/>
|
||||
<outlet property="processLabel" destination="hBk-3O-ze9" id="dZb-Wh-Z9j"/>
|
||||
<outlet property="resultLabel" destination="HLr-pN-Kn5" id="xna-3f-s3J"/>
|
||||
<outletCollection property="numberButtons" destination="iKJ-gm-pgJ" collectionClass="NSMutableArray" id="pku-qD-GzX"/>
|
||||
<outletCollection property="numberButtons" destination="nAR-KS-hdA" collectionClass="NSMutableArray" id="BPw-Wl-WA0"/>
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
import Foundation
|
||||
|
||||
class Calculator {
|
||||
var formula = ""
|
||||
var process = ""
|
||||
var result = ""
|
||||
|
||||
func click(_ text: String) {
|
||||
if text == "AC" {
|
||||
formula = ""
|
||||
process = ""
|
||||
} else {
|
||||
formula += text
|
||||
process += text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import UIKit
|
||||
class ViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var borderView: UIView!
|
||||
@IBOutlet weak var formulaLabel: UILabel!
|
||||
@IBOutlet weak var processLabel: UILabel!
|
||||
@IBOutlet weak var resultLabel: UILabel!
|
||||
@IBOutlet var numberButtons: [UIButton]!
|
||||
|
||||
@@ -23,7 +23,7 @@ class ViewController: UIViewController {
|
||||
}
|
||||
|
||||
func updateView() {
|
||||
formulaLabel.text = calculator.formula
|
||||
processLabel.text = calculator.process
|
||||
resultLabel.text = calculator.result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user