开发者

Custom Keyboard for UITextView , appending the text

I wanted to make a basic custom keypad for the iPhone , I did manage to terminate the default iPhone keypad.

I have made simple Q W E R T Y and Spacebar keys .. I want to input text as QWERTY with the buttons and then if I click and put the blinker(yes the UITextView is editable) before Q and try to append it the next string becomes QWERTYQ where else I want QQWERTY ... I having a trouble with it .. I want to write 10 lines of text and then I should be able to edit any word in any line once I click and put the blinker in the proper place .. I am having a lot of trouble doing that :( .. Please help ..or suggest me what to look 开发者_开发百科for ...


To handle placement of each character, you would use the UITextField Delegate.

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text

You can then take the typed character "text" and put it anywhere you want within the "textView". This method gets called for every character entered.

To get what you want, you'll need to do some string manipulation. You'll need to check the range and figure out based on the range whether you want to append or prepend the "text".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜