Whenever I type in a text view in my application, the cursor jumps from wherever it was (and should be,) to the end of the text.
The line in the for loop seems to be the issue. If I comment out just that, it runs perfectly fine.
Does anyone have a simple solution for this (IE, there's a method already in the SDK that I'm overlooking that'll do it for me,) or am I going to have to determine the cursors position just before the loop and then put it back where it was afterwards myself?
Edit: I've added an if before the line to make sure there's actually something to replace beforehand, now.
The line in the for loop seems to be the issue. If I comment out just that, it runs perfectly fine.
Code:
- (void)textViewDidChange:(UITextView *)textView
{
for (NSString *key in shortcuts)
{
typeView.text = [typeView.text stringByReplacingOccurrencesOfString:key withString:[shortcuts objectForKey:key]];
}
}
Edit: I've added an if before the line to make sure there's actually something to replace beforehand, now.
Last edited: