Q: A subclass of UITextView has weird behaviors in iOS7 Hey guys I need some help here. 
I have a subclass of UITextView which used to work under iOS6. But in iOS7 it has some weird behaviors. I override the shouldChangeTextInRange method so I can handle some keyboard inputs.
The following code shows this strange behavior. When you press 'a'(or you can replace 'a' with any other char you want), the cursor will jump backward to somewhere in the UITextView then come back where its supposed to be.
In iOS6 it never shows something like this. In iOS7, it wont affect user's input but it really looks weird.
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {

    NSMutableString *updatedText = [[NSMutableString alloc] initWithString:textView.text];
    [updatedText insertString:text atIndex:range.location];
    const char *pch = [text UTF8String];

    switch (*pch) {
        case 'a': // you can replace it with any other char.
            textView.text = updatedText;
            return NO;
            break;

        default:
            return YES;
            break;
    }
}

I put this demo in a simple project if you wanna see.
    https://dl.dropboxusercontent.com/u/75922069/test-uitextview.zip

A: I made a workaround with creating a NSLayoutManager to solve this bug. Or if you only need to get the correct textVIew.contentSize, you can get the detail info from here:
Click here

A: Try changing the text in the NSTextStorage object of the UITextView directly. You can do something like this:
[myTextView.textStorage replaceCharactersInRange:(NSRange) withString:(NSString *)]

or
[myTextView.textStorage insertAttributedString:(NSAttributedString *) atIndex:(NSUInteger)]

Please note this will only work in IOS 7...
