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
现在,当我点击文本框时,按照下面的计算器弹出窗口,它不在键盘出现的位置。也没有任何按钮工作。
非常感谢,如果有人能告诉我如何得到这个固定的。