aba*_*ab5 5 ios swift ios8 ios-app-extension custom-keyboard
我在Swift中创建了一个自定义键盘,但它被App Store拒绝了,因为:"键盘扩展名不包括Number和Decimal类型".
如何轻松添加这两个键盘?
我试图重建原始视图但它无法正常工作.我确信有一个解决方案可以创建2或3个不同的视图并在它们之间切换.
当键盘类型改变时,如何在键盘类型之间切换?
您可以在 中检测键盘类型的更改textDidChange。您需要获取UITextDocumentProxy然后检测代理的keyboardType,然后您可以执行所需的任何布局更改。
override func textDidChange(_ textInput: UITextInput?) {
// Called when the document context is changed - theme or keyboard type changes
let proxy = self.textDocumentProxy as UITextDocumentProxy
if proxy.keyboardType == UIKeyboardType.numberPad
|| proxy.keyboardType == UIKeyboardType.decimalPad {
//add code here to display number/decimal input keyboard
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
753 次 |
| 最近记录: |