Does a UIView rotated 45 ° disappear?

Maybe I don’t get it. When i do

self.tweetPeak.transform = CGAffineTransformMakeRotation(RADIANS(45)); 

where is radian

 #define RADIANS(degrees) ((degrees * M_PI) / 180.0) 

on a simple UIView object, it will disappear.

I think it is just subtle to see. My impression is that the view is getting smaller in the range of 20 to 45 degrees.

What is it? I tried to make the view opaque. No effect.

Chris

+6
source share
1 answer

You need to stop adjusting the frame after rotation, it causes an undesirable stretching of the transformation matrix, I'm not sure of the official reason, but this has something to do with Apple, using its own matrix system, and not traditional matrices for representing 2D / 3D translations / rotations / scaling. I had the same problem the other day to fix it, instead of rotating this point of view, I just made it a container with the actual look that I wanted to rotate inside, and rotated it.

+9
source

Source: https://habr.com/ru/post/909886/


All Articles