gpt4 book ai didi

ios - 计算器中的历史记录用照片代替符号

转载 作者:行者123 更新时间:2023-11-28 06:10:06 25 4
gpt4 key购买 nike

我有在计算器中显示历史记录的代码,但符号(+、-、×、÷)取自“案例”(照片 1)

**Photo 1**

如何才能让历史上的符号(+、-、×、÷)显示为我设置的图片(图2)

**Photo 2**

@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 "÷":
if secondOperand == 0 {
Error.text = NSLocalizedString("Division by Zero", comment: "")
break
} else {
operateWithTwoOperands{$0 / $1}
}
default: break
}
}

添加历史:

func addHistory(text: String){
//Add text
resultLabelText.text = resultLabelText.text! + "" + text
}

最佳答案

不需要图像或属性字符串。您可以将 Unicode 字符 (U+20E3 - Combining Enclosing Keycap)与各种数学符号一起使用:+- ×÷=

把这些放在一起得到:+⃣-⃣×⃣÷⃣=⃣.

关于ios - 计算器中的历史记录用照片代替符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46997172/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com