当前位置:网站首页>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:边栏推荐
- 将本地电脑文件复制到虚拟机系统中详细方法
- Goland常用快捷键设置
- [solved] failed! Error: Unknown error 1130
- 六,购物⻋与订单
- 元宇宙由哪些底层技术支撑?
- QT generate random number qrandomgenerator
- [JSON tutorial] Chapter 1 learning notes
- Promise async/await
- Double click the idea to solve the problem of downloading again
- The maximum expression in Oracle database message list is 1000 error
猜你喜欢

Class template case - encapsulation of array classes

Linux server installation redis
![[hot100] palindrome substring and longest palindrome substring](/img/a5/10dec640f02023c4d55cb42e6309fb.png)
[hot100] palindrome substring and longest palindrome substring

Linux服務器安裝Redis

1285_ Expand macros defined by AUTOSAR functions and variables with scripts to improve readability

B站首个UP主付费观看视频还是来了!价格“劝退”网友

系统软件开发基础知识
![[JSON tutorial] Chapter 1 learning notes](/img/ce/cf74b396a8bd4c4c7028663b8cb665.png)
[JSON tutorial] Chapter 1 learning notes

Merge: extension click the El table table data to expand

【每日一题】535. TinyURL 的加密与解密
随机推荐
网络安全-路由原理
Stm32g0 Tim interrupt use
app quits unexpectedly
Introduction to go project directory structure
已解决:initialize specified but the data directory has files in it. Aborting
Ad usage notes
Base64 encoding method implemented by native JS
[datawhale team learning] task02: mathematical operation, string and text, list
Class templates and friends
IDEA import导入的类明明存在,却飘红?
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
1285_ Expand macros defined by AUTOSAR functions and variables with scripts to improve readability
QT common macro definitions
Egret P2 physical engine (1) small ball falling demo
Win10 step pit - power on 0xc0000225
Win10踩坑-开机0xc0000225
[hot100] palindrome substring and longest palindrome substring
Grep command usage
Linux server installation redis
我今年毕业,但我不知道我要做什么