On May 3, 2017, at 09:27 , Richard Charles <rcharles...@gmail.com> wrote:
> 
> So it appears that simply allowing the the size of a subview to go negative 
> when autoresizing fixes an issue that has been around since the days of 
> NeXTSTEP. So what am I missing?

I dunno, but I think you need to be a bit cautious with your solution.

I have a vague recollection from years ago of running into trouble trying to 
use a NSSize structure with negative values. The details are lost, but IIRC 
there were situations where the negative value was replaced by its absolute 
value.

Looking at the documentation for NSSize, I see this:

> Normally, the values of width and height are non-negative. The functions that 
> create an NSSize structure do not prevent you from setting a negative value 
> for these attributes. If the value of width or height is negative, however, 
> the behavior of some methods may be undefined.

Looking at the documentation for CGSize, I see this:

> A CGSize structure is sometimes used to represent a distance vector, rather 
> than a physical size. As a vector, its values can be negative.


Currently (that is for any macOS code that *isn’t* legacy 32-bit or doesn’t use 
the "build 32 bit like 64 bit” letting) NSSize and CGSize are literally the 
same thing, so I have to assume the discrepancy in the documentation reflects a 
difference that existed in the bad old days when NSSize and CGSize were 
different structs.

Putting all that together, I would tentatively conclude that setting the 
subview size negative probably wouldn’t have worked for legacy 32-bit code, 
probably does work for current architectures, except that there may still be 
some edge cases where it still won’t behave exactly as you intend. You may be 
living a little dangerously, and how little that is, I don’t know.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to