Applying transform to UITextView - prevent content resizing Applying transform to UITextView - prevent content resizing ios ios

Applying transform to UITextView - prevent content resizing


I was also stuck with this problem.

The only solution which I found was to create an instance of UIView and add the UITextView as a subview. Then you can rotate the instance of UIView and UITextView will work just fine.

UITextView *myTextView = [[UITextView alloc] init];[myTextView setFrame:CGRectMake(0, 0, 100, 100)];UIView *myRotateView = [[UIView alloc] init];[myRotateView setFrame:CGRectMake(20, 20, 100, 100)];[myRotateView setBackgroundColor:[UIColor clearColor]];[myRotateView addSubview:myTextView];myRotateView.transform = CGAffineTransformMakeRotation(0.8);[[self view] addSubview:myRotateView];


Have you tried applying the rotation by doing a layer transform rather than a transform on the view?

#import <QuartzCore/QuartzCore.h>mytextField.layer.transform = CATransform3DMakeRotation (angle, 0, 0, 1);

This might be enough to trick whatever broken logic exists inside the core text field code.