Create UITextView row without editing and move cursor to next line
I am having a problem where I want the rows of the UITextView not to be edited along with the number of rows they are occupying. When clicking on the textbox, it should start editing from the next line, for example if the first two lines are pre-filled with some text, I want the cursor on the third line and the first two lines of the UItextView not to be edited.
I have tried various solutions, but the most likely one was
How do I set the cursor position for a non-editable UITextView?
But creepy !! it didn't help .. Any additional help would be much appreciated.
Thank!
+3
source to share
1 answer
Here is the solution I found,
- (BOOL)textView:(UITextView *)txtView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
//Check for back space character with @""
if ([text isEqualToString:@""])
{
//Check for the final character in the text view if its a new line character
if ([txtView.text hasSuffix:@"\n"]) {
NSLog(@"Yes I have it");
return NO;
}
}
return YES;
}
Hope this helps.
0
source to share