On 22 Sep 2013, at 21:36, Kyle Sluder <[email protected]> wrote:

> On Sep 22, 2013, at 4:20 AM, Dave <[email protected]> wrote:
>> 
>> 
>>> On 21 Sep 2013, at 21:38, Markus Spoettl <[email protected]> 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.
>> 
>> I'm in a similar position, in fact I have a lot of code that is ULO based 
>> and a lot of code that is LLO based. If I has only a single wish that would 
>> enable me to change something about Cocoa it would be that it always ULO or 
>> as a second wish that iOS used LLO as well. 
>> 
>> I'd really like to know why LLO was chosen for the Mac in the first place, 
>> and, why in iOS they chose to do the opposite?
> 
> Because OS X is derived from NEXTSTEP, which used Display PostScript as its 
> windowing system. PostScript has a lower-left origin because that's how 
> Cartesian coordinate systems are often defined, including those used on 
> plotters.
> 
>> 
>> Anyone understand why/how this happened?
>> 
>> Also, given that you have code what is written for both systems, how have 
>> people dealt with this?
> 
> If you're just drawing using Core Graphics, you can flip the CTM and get the 
> right results. But if you have subviews or sublayers, you're hosed.
> 
> Just so you know, OS X supports both origins. AppKit exposes 
> -[NSGraphicsContext isFlipped] and -[NSView isFlipped], so coordinate-space 
> agnostic code does a lot of `y = [self isFlipped] ? CGRectGetMinY(…) : 
> CGRectGetMaxY(…)`.


Ahhhh, yes that makes sense, thanks a lot.

All the Best
Dave


_______________________________________________

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