import UIKit
class MainVC: UIViewController {
@IBOutlet weak var wageTxt: CurrencyTextField!
@IBOutlet weak var priceTxt: CurrencyTextField!
override func viewDidLoad() {
super.viewDidLoad()
let calcBtn = UIButton(frame:CGRect(x:0, y:0,width:view.frame.size.width, height:60))
calcBtn.backgroundColor = #colorLiteral(red: 0.9372549057, green: 0.3490196168, blue: 0.1921568662, alpha: 1)
calcBtn.setTitle("Calculate", for: .normal)
calcBtn.setTitleColor(#colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0), for: .normal)
calcBtn.addTarget(self, action:#selector(MainVC.calculate), for: .touchUpInside)
wageTxt.inputAccessoryView = calcBtn
priceTxt.inputAccessoryView = calcBtn
}
@objc func calculate(){
print("we got here")
}
}
我的键盘正在显示,但是“计算”按钮没有弹出。我尝试了所有可能的方式。