Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7457823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:22:18+00:00 2026-05-29T13:22:18+00:00

When I apply a rotation transform to a UITextView and then click inside to

  • 0

When I apply a rotation transform to a UITextView and then click inside to begin editing, it appears that the content size is automatically being made wider. The new width of the content view is the width of the rotated view’s bounding box. For example, given a text box of width 500 and height 400, and rotated by 30 degrees, the new content width would be:

(500 * cos(30)) + (400 * sin(30)) = 633

Or graphically:

enter image description here

Interestingly, if you are already editing the text view and THEN apply the transform, then it appears that no modification is made to the content size. So it appears that sometime around the start of text editing, the text view looks at its frame property and adjusts the content size based on the frame width. I imagine the solution to this is to tell it to use the bounds property instead, however I don’t know where to do this, as I’m not sure exactly where the text view is deciding to modify the content size.

I have googled but can’t seem to find any references to using transformed UITextViews. Does anybody have any ideas about this?

EDIT (button action from test project):

- (IBAction)rotateButtonTapped:(id)sender {
    if (CGAffineTransformIsIdentity(self.textView.transform)) {
        self.textView.transform = CGAffineTransformMakeRotation(30.0 * M_PI / 180.0);
    }
    else {
        self.textView.transform = CGAffineTransformIdentity;
    }

    NSLog(@"contentsize: %.0f, %.0f", textView.contentSize.width, textView.contentSize.height);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T13:22:18+00:00Added an answer on May 29, 2026 at 1:22 pm

    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];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am drawing an image from MetaFile (emf) and then apply some rotation transformations
For whatever reason, when I apply a CSS transform to a paragraph that already
I'm trying to apply a transform to a 3D object in a STL File
What rules apply to the name that ends up in the exports section of
I have a System.Drawing.Drawing2D.Matrix with rotation and translation transforms which I need to apply
I have a UIView object that rotates using CALayer 's transform: // Create uiview
So I have a FrameworkElement to which I apply a template that has a
I have an image in OpenGL that I am attempting to apply a simple
I want to apply an XSLT Stylesheet to an XML Document using C# and
This question would probably apply equally as well to other languages with C-like multi-line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.