CGGeometry.h Silliness

Given a rectangle whose edges can be specified by the lines y = 10, y = 50, x = 5 and x = 25:

Q1, Q2: What should the Max and Min X be?
Q3, Q4: What should the Max and Min Y be?

If you’re using the CGRectGetMax family of functions, the answers are:

A1: CGRectGetMaxX = 25
A2: CGRectGetMinX = 5
A3: CGRectGetMaxY = 50
A4: CGRectGetMinY = 10

That seems logical, however this is contrary to the documentation which states that CGRectGetMaxY returns the TOP EDGE of the rectangle, which should be Y = 10 when you’re using UIKit.

But no, the top edge is 50 when whenever the user space is AppKit or Quartz, which was most of Apple’s history up to this day.

Sigh.

Advertisements