【发布时间】:2015-08-13 05:32:34
【问题描述】:
我正在尝试使用计算器作为 swift 中 UITextField 的自定义输入视图。
我有一个计算器在我的应用程序中单独定义为 CalculatorViewController。
我需要访问 InputViewController 中 UITextField 中的 CalculatorViewController。
我在 InputViewController 中定义了以下属性来访问计算器视图
var textFieldInputView : UIView!{
let calculatorInputController = self.storyboard?.instantiateViewControllerWithIdentifier("calculatorVC") as! calculatorViewController
let calculatorInputView = calculatorInputController.view
return calculatorInputView
}
然后在 textField 中添加以下代码以访问 textFieldInputView
textField.inputView = textFieldInputView
现在,当我单击文本字段时,弹出计算器,如下所示,它不在键盘出现的位置。也没有按钮工作。
如果有人能告诉我如何解决这个问题,我们将不胜感激。
【问题讨论】:
标签: ios swift uitextfield inputview