Reputation: 1579
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 .
Like the one shown in figure.
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.
I am unable to understand how should i proceed with that and which component should i use to create that toobar above the keyboard.
using IOS SDK 5.1 and xcode 4.3
Upvotes: 4
Views: 3841
Reputation: 126107
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.
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.
Upvotes: 3
Reputation: 11839
You can use accessory view of keyboard to achieve this, check out this developer same code- http://developer.apple.com/library/ios/#samplecode/KeyboardAccessory/Introduction/Intro.html
Upvotes: 1