Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Log in or create an account to edit The Apple Wiki.

Dev:MTMaterialView

From The Apple Wiki

MTMaterialView is a subclass of UIView within Apple's private MaterialKit.framework. It provides standardized, system-consistent blur, vibrancy, and texture visual effects throughout the iOS interface.

Creating an instance

The simplest way to create an instance of this class is using the following method:

+(id)materialViewWithRecipe:(NSInteger)recipe configuration:(NSInteger)configuration;

Example:

MTMaterialView *materialView = [objc_getClass("MTMaterialView") materialViewWithRecipe:1 configuration:1];
materialView.frame = CGRectMake(0, 0, 200, 200);
[self.view addSubview:materialView];

Recipe Values & Descriptions

The visual appearance of an MTMaterialView is determined by the recipe parameter:

Recipe Value Recipe Name Description
0 MTMaterialRecipeNone No blur or special effect applied.
1 MTMaterialRecipeNotifications Blur effect used for Notification Center notifications.
2 MTMaterialRecipeWidgetHosts Blur effect behind widget hosting areas (such as Home Screen widgets).
3 MTMaterialRecipeWidgets Blur effect for the background of widgets themselves.
4 MTMaterialRecipeControlCenterModules Standard blur effect for Control Center modules.
6 MTMaterialRecipePreviewBackground Blur effect for preview backgrounds, e.g., Peek/Pop previews.
7 MTMaterialRecipeNotificationsDark Darker variant blur specifically for notifications in dark UI modes.
8 MTMaterialRecipeControlCenterModulesSheer Lighter, semi-transparent blur for Control Center modules.
9 MTMaterialRecipeSiriPlatter Siri response UI blur background.
10 MTMaterialRecipeSiriPlatterSheer Lighter variant of Siri response blur.
11 MTMaterialRecipeSiriDialogue Siri full-screen dialogue blur effect.
12 MTMaterialRecipeSpotlightPlatter Blur behind Spotlight search UI.
13 MTMaterialRecipeSpotlightPlatterSheer Lighter variant blur behind Spotlight search.
14 MTMaterialRecipeSpotlightBackground Spotlight search result background blur.
15 MTMaterialRecipeCarPlayNotifications Blur used in CarPlay notification backgrounds.
16 MTMaterialRecipeSiriBackground Background blur for Siri interaction.
17 MTMaterialRecipeSleepPlatter Sleep/Wake notifications blur.
18 MTMaterialRecipeSleepPlatterSheer Lighter variant for Sleep notifications.
19 MTMaterialRecipeDock Background blur for Home Screen Dock.
20 MTMaterialRecipeControlCenterBackground Background blur for Control Center overlay.
21 MTMaterialRecipeControlCenterBackgroundSheer Lighter variant of Control Center background.
22 MTMaterialRecipeSessions Blur for media/session player backgrounds (like Now Playing).
23 MTMaterialRecipeActivityAmbientCompact Compact ambient blur for Activity UI elements.
50 MTMaterialRecipeSystemChromeBackground Standard blur for system chrome (navigation bars, tab bars).
51 MTMaterialRecipeSystemVibrantBackgroundUltraThin Ultra-thin vibrancy blur for subtle backgrounds.
52 MTMaterialRecipeSystemVibrantBackgroundThin Thin vibrancy blur.
53 MTMaterialRecipeSystemVibrantBackgroundRegular Regular vibrancy blur used across system components.
54 MTMaterialRecipeSystemVibrantBackgroundThick Thick vibrancy blur for more pronounced effect.
101 MTMaterialRecipeNotificationsDark Darker variant blur specifically for notifications in dark UI modes.

Important Properties & Helpers

Weighting

The weighting property defines the intensity of the applied blur or vibrancy effect:

@property (nonatomic) CGFloat weighting; // Range: 0.0 (no blur) - 1.0 (full blur)

Example Usage of Weighting

materialView.weighting = 0.5; // 50% intensity blur

Configuration Parameter

Appears to alter internal styling variants and specific render modes within each recipe context. For standard usage, setting configuration to 1 usually provides consistent results.

Common System Usage

MTMaterialView is widely used by iOS itself to implement visual elements like:

  • Control Center backgrounds
  • Home Screen folders
  • Widgets
  • Notifications
  • Siri interface
  • Spotlight search results

Other info

  • Internally, MTMaterialView uses a combination of system-level CAFilters applied directly to the view's underlying CALayer to produce the blur, vibrancy, and blending effects.
  • Adjusting properties such as blurEnabled, zoomEnabled, and captureOnly significantly affects the visual output.
  • Changing accessibility settings (like reducing motion or transparency) triggers automatic updates to the view's appearance, handled internally by methods like _setupOrInvalidateAlphaTransformer.

External Links