I've got a problem.
I've an UIImageView
and i do some rotation to it with CGAffineTransformMakeRotation()
.
Not problem with that.
But when i do a rotation with my UIViewController
(portrait to landscape and/or inverse).
My UIImageView
is modified strangely.
Its frame become change from :CGRectMake(50.f, 50.f, 150.f, 150.f)
to a frame like :CGRectMake(50.f, 123.2f, 1004.56f, 1530.456f)
I realize that changes happens when I do UIViewController rotation when i've done a rotation on my UIImageView
not equal to 0, 90, 180, or 270
I think it's because the UIViewController
change the rect of the UIImageView
but how inhibit
that comportement
Unfortunately my view move/change visually.
That's my problem and why I'm talking about that here...
I spoke about the frame
property because I 开发者_运维知识库notice it changed strangely (and randomly) and even if I changed it after to my original frame
. The view doesn't seem 'listen' to it.
I hope I am well.
Anyone for a solution ?
If you set a view's transform
property to anything but the identity matrix (which you must have done in order to rotate it), the frame
property becomes undefined and should be ignored. This is noted in the documentation. Is it just the frame property that goes wrong or is the view moving/changing visually in some unexpected way as well?
It's not clear from your description, but it sounds as if your UIImageView
is a subview of the view owned by your UIViewController
. Unless you have a reason to not manage it this way, I'd suggest setting the UIImageView
struts and springs (i.e., its autoresizingMask
) to surface the desired behavior and then allow the parent view to reposition/resize the UIImageView
.
精彩评论