views:

531

answers:

1

Hey Guys , 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 ...

+1  A: 

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".

Jordan
No 'putting' the blinker(|) is not the problem .. it does get placed ... but appending the string is the big issue ...
Answer has been edited, with delegate information.
Jordan
@Jordan thank ... But the "field" is the UITextView not UITextField,I am still facing the problem , it does print in the UITextView .. but not appending it the way I stated above ... Thanks for the above info ... How can I impelement that now ...
Answer edited again.
Jordan
@Jordan thanks dude .. I really appreciate that .. :)