On Sep 21, 2013, at 22:38 , Markus Spoettl <[email protected]> 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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to