I donβt know if you need to know this in combination with other text or to detect only a single click, but here is my solution to detect the first:
in my case it is only one character inside:
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)inText
this converts the uppercase text to lowercase and sets the value to shiftPressed (ignored if the text is not alphabetic text)
source share