toggle quoted messageShow quoted text
Mac uses bottom-left for the origin, which is why everything is "flipped in the Y direction".
You *can* do the calculation to move the origin to top-left and scale the transform in the opposite Y direction, but it's probably just as easy to "re-orient" yourself to bottom-left on macOS.
On Aug 30, 2017, at 4:14 AM, Dave <dave@...
I’m converting some Manual Layout code from iOS to Mac.
I’m overriding “layout” in my class, it calculates and sets the Frame Rect for all its subviews. This works ok on Mac, except, as expected, everything is flipped in Y. I’m now trying to figure out how to flip the Y Coordinate.
Given that I have calculated the Frame Rect of a subview correctly, I’m then doing this:
myCalculatedFrameRect = the top, left Rectangle
myRect.origin.y = self.frame.size.height - myCalculatedFrameRect.origin.y;
[mySubview setFrame: myRect];
Which doesn’t work!
self in this case is the View I’m laying out, e.g. the superview of the subview,
What magic do I need to make this work? I was wondering if I should “flip” the View with the “isFlipped” method, but I’m not sure what other problems this might cause and would rather just flip the Coordinate in the layout method…..
All the Best