0
我想在swift中使用一個計算器作爲UITextField的自定義輸入視圖。在Swift中添加自定義輸入視圖到UITextField
我有一個計算器作爲CalculatorViewController在我的應用程序中單獨定義。
我需要訪問我的InputViewController中的UITextField中的CalculatorViewController。
我定義的InputViewController以下屬性來訪問計算器視圖
var textFieldInputView : UIView!{
let calculatorInputController = self.storyboard?.instantiateViewControllerWithIdentifier("calculatorVC") as! calculatorViewController
let calculatorInputView = calculatorInputController.view
return calculatorInputView
}
然後添加在文本框下面的代碼來訪問textFieldInputView
textField.inputView = textFieldInputView
現在,當我點擊文本框時,按照下面的計算器彈出窗口,它不在鍵盤出現的位置。也沒有任何按鈕工作。
非常感謝,如果有人能告訴我如何得到這個固定的。