在ios键盘上方显示建议工具栏 [英] displaying suggestion toolbar above ios keyboard

查看:328
本文介绍了在ios键盘上方显示建议工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS开发的新手。我试图在ios 5.1中创建一个拼写建议类型的应用程序,它有一个textView,如果用户点击键盘的键,建议工具栏来到键盘的顶部,包含所有的建议,如果用户点击其中一个建议它将显示在textView上。

I am a newbie in iOS development. I am trying to create a spell suggestion type application in ios 5.1 having a textView such that if user taps on a key of the keyboard a suggestion toolbar come at the top of the keyboard containing all the suggestions and if user taps onto one of those suggestions it will be displayed on the textView .

如图所示。

我处理了键盘按事件并处理了所有处理。现在我想做的是,我有一个NSArray的建议,我想创建一个建议工具栏,并将所有这些建议从NSArray到该工具栏,并且如果用户点击任何这些建议,它应该放在textView。

I have handled the keyboard press event and handled all processing over there. Now what i want to do is that i have a NSArray of suggestions and I want to create a suggestion toolbar and assign all those suggestion from NSArray to that toolbar and also if user taps on any of those suggestion it should be placed on the textView.

我无法理解我应该如何处理,我应该使用哪个组件在键盘上创建该toobar。

I am unable to understand how should i proceed with that and which component should i use to create that toobar above the keyboard.

推荐答案

使用IOS SDK 5.1和xcode 4.3

解决方案

通过使 inputAccessoryView 用于任何文本编辑控件( UITextField UITextView ,etc)。请参阅 UITextInputTraits 协议文档

You can make a view stick to the top of the keyboard by making it the inputAccessoryView for whichever text editing controls (UITextField, UITextView, etc) you want it to appear with. See the UITextInputTraits protocol docs for details.

如果您不确定从何处开始显示可以点击的字词,您可能需要查看查看编程指南或一个好的介绍到iOS版本,编程书。

If you're not sure where to start on making a view showing words which can be tapped, you might want to look at the View Programming Guide or a good intro-to-iOS-programming book.

这篇关于在ios键盘上方显示建议工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆