> On 1 Mar 2016, at 10:24 AM, Doug Hill <[email protected]> wrote:
> 
> Given the amount of private implementation in NSView, my guess is that 
> copying an NSView yourself without super support would be 
> difficult/impossible in practice. However, I would be interested in others 
> with more information to give an opinion.


Agreed, and the need to copy something designed to be uncopyable in general may 
be a code smell. It might be a case that the view in question should ‘have a’ 
whatever copyable thingamajig instead of being subclassed to ‘be a’ 
thingamajig. In the few cases where copying views is legitimate (I can think of 
one case where I programatically created a stack of views based on a series of 
templates - but that was before NSViewController existed and that would 
probably be the right solution now) you can use the archive/dearchive solution 
to copy a view. Alternatively, it might be enough to create a view as part of a 
copy and only use basic properties such as its frame to define the copied one. 
If it has subviews though… ugh.

G.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to