O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

For the More Curious: Flipped Views

Both PDF and PostScript use the standard Cartesian coordinate system, in which y increases as you move up the page. AppKit views follow this model by default. Thus, the origin is usually at the lower-left corner of the view.

For some types of drawing, the math is easier if the upper-left corner is the origin and y increases as you move down the page. Such a view is said to be flipped.

To flip a view, you override the flipped property to return true:

 ​ ​o​v​e​r​r​i​d​e​ ​v​a​r​ ​f​l​i​p​p​e​d​:​ ​B​o​o​l​ ​{​
 ​ ​ ​ ​ ​ ​r​e​t​u​r​n​ ​t​r​u​e​
 ​ ​}​

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required