【发布时间】:2017-10-14 13:21:13
【问题描述】:
我有结果复制按钮的代码(来自 displayResultLabel)
我怎样才能让它从两个标签一次复制(来自resultLabel,displayResultLabel)
resultLabel - 历史记录
displayResultLabel - 结果
示例:
结果标签 - 5+22
显示结果标签 - 27
5+22=27
我试过这个,但我明白了: 可选 ("5 + 22") = 可选 ("27")
UIPasteboard.general.string = "\(String(describing: self.resultLabelText.text)) = \(String(describing: self.displayResultLabel.text))"
复制按钮
...
let deleteActions = UIAlertAction(title: NSLocalizedString("Copy history",comment: ""), style: .default, handler: {
(alert: UIAlertAction!) -> Void in
UIPasteboard.general.string = self.resultLabelText.text
self.present(alert, animated: true, completion:nil)
})
...
【问题讨论】:
标签: ios swift string xcode calculator