How to properly flip a UIView's coordinate system
How to properly flip a UIView's coordinate system
- Subject: How to properly flip a UIView's coordinate system
- From: Markus Spoettl <email@hidden>
- Date: Sat, 21 Sep 2013 22:38:47 +0200
Hi,
I have a UIView on iOS that shares (a lot of) code with an NSView I have on
OSX. That code relies on a LLO (lower left origin) coordinate system and it's
not an option to change that.
So I transform the coordinate system of the view by setting
[self setTransform:CGAffineTransformMakeScale(1, -1)];
in the UIView variant's -initializer. That works well, it effects all areas of
view code the right way, including drawing and touch-events. Just what I want.
Or so it seems.
Something must be wrong, because in some situations, when I animate the view's
frame (using UIView's -animateWithDuration::: methods), the system seems to have
trouble handling this view properly.
For example: Imagine the view taking up the top half of the screen, so the frame
is {0, 0, 768, 502}. When I animate the frame to cover the entire screen {0, 0,
768, 1004} the view grows instantly (half the view is now invisible beyond the
top edge) and only the position of the view gets animated. The final position
and frame are correct, the way it gets there isn't.
When I remove the transformation, the animation takes place correctly, growing
its frame, not just changing the position. Also, when I animate the frame,
leaving the size as is, the animation does what is expected, too.
So, it's the transform. Can I do something about that?
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden