iphone - 如何创建自定义键盘

如何创建一个自定义键盘/小键盘,当有人点击 UITextField 时会显示?我想显示一个带有 a、b、c、1、2、3 和输入按钮的键盘,仅此而已。键盘应该像标准键盘一样工作和表现(在行为上),但它看起来肯定会有所不同。

我找不到任何示例,我发现最好的方法是使用现有键盘过滤字符,这是一个 Not Acceptable 解决方案。

最佳答案

我认为您正在寻找“Text, Web, and Editing Programming Guide for iOS”

The UIKit framework includes support for custom input views and input accessory views. Your application can substitute its own input view for the system keyboard when users edit text or other forms of data in a view. For example, an application could use a custom input view to enter characters from a runic alphabet. You may also attach an input accessory view to the system keyboard or to a custom input view; this accessory view runs along the top of the main input view and can contain, for example, controls that affect the text in some way or labels that display some information about the text.

To get this feature if your application is using UITextView and UITextField objects for text editing, simply assign custom views to the inputView and inputAccessoryView properties. Those custom views are shown when the text object becomes first responder...


这可能是一个很好的介绍:customizing the iOS keyboard

https://stackoverflow.com/questions/4643167/

相关文章:

ios - 根据文本量更改 UITableViewCell 高度

objective-c - UIScrollView contentSize 不起作用

objective-c - 100% 不透明度 UILabel 超过 50% 不透明度背景(UIVi

iphone - 如何使用 NSLog(@"Inside of the iPhone Simulat

ios - 在 iOS 上检测飞行模式

ios - UICollectionView:如何检测滚动何时停止

iphone - 在 UITableView 的 iOS 文档目录中列出保存的文件?

ios - performFetchWithCompletionHandler 永远不会被解雇

ios - 更改 UITabBar 高度

iphone - 选中时选中的 UItableViewCell 保持蓝色