• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to properly flip a UIView's coordinate system
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to properly flip a UIView's coordinate system


  • Subject: Re: How to properly flip a UIView's coordinate system
  • From: Dave <email@hidden>
  • Date: Mon, 23 Sep 2013 12:53:34 +0100

On 22 Sep 2013, at 21:36, Kyle Sluder <email@hidden> wrote:

> On Sep 22, 2013, at 4:20 AM, Dave <email@hidden> wrote:
>>
>>
>>> On 21 Sep 2013, at 21:38, 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.
>>
>> 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@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


References: 
 >How to properly flip a UIView's coordinate system (From: Markus Spoettl <email@hidden>)
 >Re: How to properly flip a UIView's coordinate system (From: Dave <email@hidden>)
 >Re: How to properly flip a UIView's coordinate system (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: How to properly flip a UIView's coordinate system
  • Next by Date: Re: Strange behaviour of iPhone
  • Previous by thread: Re: How to properly flip a UIView's coordinate system
  • Next by thread: Re: How to properly flip a UIView's coordinate system
  • Index(es):
    • Date
    • Thread