当前位置:网站首页>Swiftui creates a beautiful custom press feedback button
Swiftui creates a beautiful custom press feedback button
2022-06-30 07:13:00 【Giant panda Hou Pei】
functional requirement
Sometimes , We need to be in SwiftUI Create an impressive button for user interaction , Like this one down here :
As shown in the figure above , We give users a colorful feedback effect after continuously pressing the view , I can't help but brighten my eyes .
How is this achieved ?
Actually , It's not as hard as you think !
So, What are you waiting for ?
Let‘s go!
Functional analysis
1. Getting the pressed state of the button is the key
In order to get different feedback effects according to the button pressing state , We first need a way to get the button pressed .
If you have implemented custom button styles , Then I will never forget Configuration.isPressed attribute .
This is exactly what we need !
1.1 Use the binding to pass the press state
struct HyButtonPressingStyle:
边栏推荐
- [daily question] 535 Encryption and decryption of tinyurl
- 【SemiDrive源码分析】【X9芯片启动流程】33 - Display模块 相关概念解析
- 6、 Shopping ⻋ and orders
- js创建pdf文件
- What underlying technologies support the metauniverse?
- Idea shortcut key
- Linux server installation redis
- [introduction to Expo application] v Expert recommendation letter template
- Write about your feelings about love and express your emotions
- 1285_ Expand macros defined by AUTOSAR functions and variables with scripts to improve readability
猜你喜欢
年轻人搞副业有多疯狂:月薪3000,副业收入3W
Connection flood attack principle
汇编语言学习一(有栈协程铺垫,32位寄存器和相关指令学习,未完待续06/29)
2、 Layout system
MySQL Optimization: from more than ten seconds to 300 milliseconds
大学刚毕业不知道做什么工作怎么办?
Introduction to go language pointer
[JSON tutorial] Chapter 1 learning notes
How to determine the size of the platform byte order?
【每日一题】535. TinyURL 的加密与解密
随机推荐
【我的OpenGL学习进阶之旅】关于OpenGL的着色器的向量和矩阵分类的访问方式: xyzw/rgba/stpq以及数组下标
Connection flood attack principle
Go common commands
Browser downloads files as attachments
El input can only input numbers and has a decimal point. At most two digits can be reserved
grep命令用法
Keil serial port redirection
Four great happenings on earth
Golan common shortcut key settings
How to convert XML to JSON
app闪退
汇编语言学习一(有栈协程铺垫,32位寄存器和相关指令学习,未完待续06/29)
vs2019和sql
MySQL优化:从十几秒优化到三百毫秒
Ad usage notes
Basic fragmentary thoughts
Merge: extension click the El table table data to expand
Double click the idea to solve the problem of downloading again
Mysql5.7 compressed version installation tutorial
Cluster distributed