【问题标题】:Change iOS System Keyboard Background Image and Buttons Image更改 iOS 系统键盘背景图像和按钮图像
【发布时间】:2023-03-10 22:51:01
【问题描述】:

而不是创建自定义键盘...如何更改 ios 键盘背景图像并以编程方式获取键盘按钮或仅键盘视图的引用?

我不想复制整个 ios 键盘,只是在这里和那里调整键盘。

解决方案更新:

您不能只更新 iOS 系统键盘的背景或按钮!这是因为 Apple 限制了对键盘 API 的访问。您最多可以做的是更改键盘背景颜色,即深色或浅色。

如果您需要像我一样将背景更改为图像,则需要扩展 ios 键盘,即制作自己的自定义键盘!

请检查下面接受的答案!

希望这会有所帮助!

【问题讨论】:

    标签: ios objective-c custom-keyboard


    【解决方案1】:

    你可以这样做,

     myTextField.keyboardType = UIKeyboardTypeDecimalPad; // many other options
    
     myTextField.keyboardAppearance = UIKeyboardAppearanceDark; //many other options
    

    如果您想完全自定义键盘,请参考this tutorial

    希望这会有所帮助:)

    【讨论】:

    • 感谢您的回答。正是我想要的。
    【解决方案2】:

    对于深色背景,您可以使用

    mytextfield.keyboardAppearance = UIKeyboardAppearanceAlert;
    

    更多定制请点击此链接: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-07
      • 2016-07-12
      • 2012-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-19
      相关资源
      最近更新 更多