How to detect user input character in UITextView?
For example:(in UITextView NOT UITextField)
when user input letter "a", trigger an event. when user input "do it", trigger another event. or input "http://www.stackoverflow.com" trigger an event.
Thanks
You can monitor the TextView content changes inside this delegate method and trigger necessary actions.
- (void)textViewDidChange:(UITextView *)textView
{
    //Access the textView Content
    //From here you can get the last text entered by the user
    NSArray *stringsSeparatedBySpace = [textView.text componentsSeparatedByString:@" "];
    //then you can check whether its one of your userstrings and trigger the event
    NSString *lastString = [stringsSeparatedBySpace lastObject];
    if([lastString isEqualToString:@"http://www.stackoverflow.com"]) //add more conditions here
    {
          [self callActionMethod];
    }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With