I am creating custom keyboard in ios .and one problem I can not figure out how to get full inputted string.because that string I want to use in my code for mapping with my dictionary database and mapping word will be displayed in my collection view.
Asked
Active
Viewed 183 times
-1
-
Show us your custom keyboard first. – dahiya_boy Jan 17 '18 at 07:06
-
Question is not clear enough. – Syed Sadrul Ullah Sahad Jan 17 '18 at 07:06
-
@SyedSadrulUllahSahad i am creating roman English keyboard which will give me an urdu suggestion for exaple when i type one word (kia) in english in suggestion bar out somthing like ( کیا ) basically with-in application i know my textfield name and get a inputed text eg NSString *str=self.txtField.text ; but in outside for example in whatsapp or any other massenger how i get text .beacuse i didnot know the name of textfield .i am sorry for my english – Muhammad Hamza Anwar Jan 17 '18 at 07:33
-
So,you are dealing with custom keyboard and of course you have your keyboard button's click functions,for example UIButton action for touch up inside. What you have to do is get characters on button press from uibutton's text and make string by appending every character. Hope this helps. – Syed Sadrul Ullah Sahad Jan 17 '18 at 07:40
2 Answers
0
From button action get text and make string what you want.
NSString *someString;// Global
- (IBAction)characterButtonAction:(UIButton *)sender {
someString = [someString stringByAppendingString:sender.titleLabel.text];
}

Syed Sadrul Ullah Sahad
- 1,182
- 9
- 15
-
-
Sir this string can also support backspace key in it forexaple when press backspace key or space key how i remove that word from my someString – Muhammad Hamza Anwar Jan 17 '18 at 08:03
-
-
You are very helpfull person i am stuck with this situation around 3 week and i m beginer you help me a lot. – Muhammad Hamza Anwar Jan 17 '18 at 08:09
-
1How to use in my code this line of code [self.textDocumentProxy documentContextBeforeInput] . to get inputed string i didnot get know to to use please guid me.. – Muhammad Hamza Anwar Jan 17 '18 at 16:19
-
e-g . NSArray *arrayOfSplitsString = [self.textDocumentProxy.documentContextBeforeInput componentsSeparatedByString:@" "]; like use – Muhammad Hamza Anwar Jan 17 '18 at 16:19
-
NSString *someString = [self.textDocumentProxy documentContextBeforeInput]; like this when you need the string . – Syed Sadrul Ullah Sahad Jan 18 '18 at 16:48
-
0
Or you can use [self.textDocumentProxy documentContextBeforeInput]
to get the whole current string visible.
This will return the string before cursor.

Syed Sadrul Ullah Sahad
- 1,182
- 9
- 15