In NSView 10.12 Detailed problem does not show shadow

On iOS,If we want to display a shadow View,So basically do:

but,To the macOS,This would not work - no effect。

The answer lies in the macOS a View If you want to use layer ,You must manually mark,For example, this:

This time,What if you are 10.13,Then everything will be fine,Then 10.12 The discovery - still no effect。

Why is this? Apple's official guide,We can find the answer,He says you should not be modified directly NSView of layer Attributes,So you should first create a NSShadow() Example,Then modify its properties,Finally, assign it to NSView 。For example, the following code,It is the proper operation:

or,You can also simply point,Give layer One shadow Example,Then go to modify them。

 

Original article written by Gerber drop-off:R0uter's Blog » In NSView 10.12 Detailed problem does not show shadow

Reproduced Please keep the source and description link:https://www.logcg.com/archives/2946.html

About the Author

R0uter

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Leave a Reply

Your email address will not be published. Required fields are marked *