-1

enter image description here

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.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 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 Answers2

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];
}
0

Or you can use [self.textDocumentProxy documentContextBeforeInput] to get the whole current string visible. This will return the string before cursor.