0
私はアプリケーションで履歴を実行するためのコードを持っています。クリックするとラベルが更新されます
=を押すだけではなく、数値をすぐに表示するにはどうすればよいですか?
私のプログラムの開発:
// Connected to button "="
@IBAction func equalitySignPressed(sender: UIButton) {
if stillTyping {
secondOperand = currentInput
}
dotIsPlaced = false
addHistory(text: operationSign + displayResultLabel.text!)
switch operationSign {
case "+":
operateWithTwoOperands{$0 + $1}
case "-":
operateWithTwoOperands{$0 - $1}
case "×":
operateWithTwoOperands{$0 * $1}
case "÷":
operateWithTwoOperands{$0/$1}
default: break
}
}
func addHistory(text: String){
//Add text
resultLabelText.text = resultLabelText.text! + "" + text
}
電流出力:
としての価値を置くことができます "addObserver(自己、forKeyPath:#keyPath(入力)、オプション:[.oldという、.new]、コンテキスト:ゼロ)" ??? – B2Fq
でviewController。 UIViewControllerの実装の一部です。 –