我有一个符合UIKeyInput协议的UIView子类。我想将键盘类型设置为numberPad。不幸的是,设置此属性没有任何作用。
var keyboardType: UIKeyboardType {
.numberPad
}编译器通过以下描述警告我:
Property 'keyboardType' nearly matches optional requirement 'keyboardType' of protocol 'UITextInputTraits'
因此,我知道此属性不是指UIKeyInput协议。我正在寻找其他称为UIKeyInput的协议或类,但我没有找到任何协议或类。
你有什么建议会导致这个问题吗?
发布于 2020-05-12 21:06:32
如documentation所示,您应该为此属性提供getter和setter。
optional var keyboardType: UIKeyboardType { get set }https://stackoverflow.com/questions/61752315
复制相似问题