glassをボタンに適応しない方法は?

Asked on 2025-06-11

1 search

To avoid applying the glass effect to buttons in a UIKit app, you can follow these guidelines:

  1. Use the isInteractive Property: If you have custom views and you don't want them to interact with the glass effect, ensure that the isInteractive property is set to false. This will prevent the glass effect from reacting to user interactions.

  2. Remove the Glass Effect: When you no longer need the glass effect on a button, you can animate it out by setting the effect to nil. This ensures that the glass dematerializes with the appropriate animation.

  3. Avoid Glass on Non-Interactive Items: In AppKit, for example, non-interactive items like custom titles and status indicators should avoid the glass material. You can remove the glass from an NSToolbar item by setting the isBordered property to false.

  4. Use Custom Tint Colors: If you need to use a different appearance, you can specify a different tint color for the button, which can help differentiate it from the glass effect.

For more detailed guidance, you can refer to the session Build a UIKit app with the new design (19:15) where custom elements and their interaction with glass are discussed.