I was recently bitten by the silly behavior of
NSRect NSIntegralRect (NSRect aRect);
… If the width or height of
aRectis 0 or negative, this function returns a rectangle with origin at (0.0, 0.0) and with zero width and height…
For some reason, I had figured integral rectangles were better for some of my views, so they would be pixel-aligned (maybe not such a smart idea to start with), and
NSIntegralRect seemed like the perfect API for that purpose. The problem was those same views had a dynamic height set in code, that started with a value of 0 before content was added. As documented, as soon as one of the dimension is zero, the rectangle is deemed rubbish by
NSIntegralRect, and the other dimension as well as the location are thrown out with the bathwater. The bottom line: my views were not showing.
You are warned.