• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSplitView Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSplitView Problems


  • Subject: Re: NSSplitView Problems
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 3 May 2017 10:23:46 -0700

On May 3, 2017, at 09:27 , Richard Charles <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >NSSplitView Problems (From: Richard Charles <email@hidden>)

  • Prev by Date: Re: strange behaviour of hasPrefix
  • Next by Date: Re: NSDocument autosavesInPlace and additional menu items
  • Previous by thread: NSSplitView Problems
  • Next by thread: Does file-mapping a memory allocation work around RAM limits?
  • Index(es):
    • Date
    • Thread