Re: How to properly flip a UIView's coordinate system
Re: How to properly flip a UIView's coordinate system
- Subject: Re: How to properly flip a UIView's coordinate system
- From: Kyle Sluder <email@hidden>
- Date: Sat, 21 Sep 2013 14:53:23 -0700
> On Sep 21, 2013, at 1:38 PM, Markus Spoettl <email@hidden> wrote:
>
> 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.
You’re not gonna like where this conversation is going.
> 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.
This is because the frame of a view is meaningless once you've applied a transform.
Unlike the Mac, on iOS the frame and bounds do not define two separate coordinate systems. A UIView's size in its superview’s coordinate space is defined by its bounds.width. So flippedness doesn't really make sense on iOS.
> So, it's the transform. Can I do something about that?
You can fix your code to be origin-agnostic.
--Kyle Sluder
_______________________________________________
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