简体   繁体   中英

Change tint color of keyboard for UITextField

I would like to set a custom color for the keyboard that is associated with a UITextField. I see that I can set the UIKeyboardAppearanceType, but I would like to be able to set the color to arbitrary color, rather than just change to a different default setting. I was hoping it would be as simple as something like this:

keyboard.tintColor = [UIColor colorWithRed:...]

Any suggestions?

没有公共API可以访问系统键盘,因此您很幸运,没有从头开始重新编写UIKeyboard(这是一个坏主意),或者找到一些私有API来完成这项工作(如果您想要的话,这是一个坏主意)提交到App Store)。

You could use Alert style keyboard and place a view in the background with a background color of your choice. This will make the keyboard a different color.

In Xcode look for the 'Keyboard Look' attribute in the Text Input Traits section of the Attributes Inspector. Can toggle between Light/Dark.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM