mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-02-20 08:27:32 +08:00
24 lines
698 B
Markdown
24 lines
698 B
Markdown
### Customizing elevation
|
|
|
|
The elevation of a button can be changed for a given control state using `setElevation:forState:`.
|
|
|
|
See the [Material Design shadow guidelines](https://material.io/guidelines/what-is-material/elevation-shadows.html) for a detailed
|
|
overview of different shadow elevations.
|
|
|
|
For example, to make a button elevate on tap like a floating action button:
|
|
|
|
<!--<div class="material-code-render" markdown="1">-->
|
|
#### Swift
|
|
```swift
|
|
button.setElevation(6, for: .normal)
|
|
button.setElevation(12, for: .highlighted)
|
|
```
|
|
|
|
#### Objective-C
|
|
|
|
```objc
|
|
[button setElevation:6.0f forState:UIControlStateNormal];
|
|
[button setElevation:12.0f forState:UIControlStateNormal];
|
|
```
|
|
<!--</div>-->
|