1

I've one UITextView. In that I want to add text to anywhere without press enterkey.

Currently It is allowing to add text to any where by pressing enter key. Like If I'm adding text to 1 line then want to add text to 4th line then I have to press enter and then write.

Now I want that I can add text to any line without pressing enter key. If I'm adding text to 1 line then If I want to add text to 4'th line then I can tap on 4th line and then start adding text.

Any one know how to do this? Or any other solution if its not possible.

I have requirement to make app like note app but add text to any line that user want without press the enter key.

Thanks.

Ekta Padaliya
  • 5,743
  • 3
  • 39
  • 51
  • Will the UITextView contain pre filled text, as in, text populated from your objective-c code? – Manoj Aggarwal Oct 21 '16 at 06:24
  • Not pre filled need to add. Yes text populated from objective-c code. – Ekta Padaliya Oct 21 '16 at 06:25
  • 1) Calculate H = Height of line, 2) Calculate Lines= number of lines in Current text with http://stackoverflow.com/questions/3585470/how-to-read-number-of-lines-in-uitextview 3) Implement Tap gesture, and find yPos of touch in UITextView. -- numofLineRequire = yPos/H; if lines < numofLineRequire, append "\r\n" to Existing text for (numofLineRequire-Lines) time...at the end, call [textView becomeFirstResponder]. – PlusInfosys Oct 21 '16 at 06:31
  • @iOS_devloper " Height of line" means? – Ekta Padaliya Oct 21 '16 at 06:35
  • @EktaPadaliya i mean height required for one line..which should be yourTextView.font.lineHeight – PlusInfosys Oct 21 '16 at 06:38
  • @iOS_devloper Let me try – Ekta Padaliya Oct 21 '16 at 06:40

0 Answers0