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: Marcel Weiher <email@hidden>
- Date: Mon, 23 Sep 2013 13:20:37 +0200
On Sep 21, 2013, at 22:38 , Markus Spoettl <email@hidden> wrote:
> 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.
What’s the code? Mostly drawing?
> 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.
Yeah, I have to admit I haven’t been too happy with View coordinate system transformations in general. I just do the transform in the drawing code ( MPWView and MPWDrawingContext handle this automatically).
Since event handling code is quite distinct anyhow, I so far haven’t had a burning desire to exploit commonality there, but I’d probably do the transform “by hand” as well (encapsulated so I do it once). Again, since you have different methods to start with, just define your own coordinate system for your own methods and map what the system gives you to that in the system-specific event methods.
Marcel
_______________________________________________
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