当前位置:网站首页>SwiftUI 手势大全之可用的手势类型有哪些(教程含源码)
SwiftUI 手势大全之可用的手势类型有哪些(教程含源码)
2022-07-29 21:03:00 【知识大胖】
SwiftUI 中可用的手势类型有哪些?
- onTapGesture
- onLongPressGesture
- highPriorityGesture
- simultaneousGesture
- DragGesture
onTapGesture 点击发生时触发
onTapGesture 将在点击发生时触发
Text("Hello, World!")
.onTapGesture() {
print("tapped!")
}
点击Hello, world!文本时输出
tapped!
Double tap Gesture 多次连击
我们只是添加了一些计数onTapGesture,所以当我们点击 == 计数时它会触发
Text("Hello, World!")
.onTapGesture(count: 2) {
print("Double tapped!")
}
点击Hello, world!文本时输出
Double tapped!
onLongPressGesture 长按时会触发
当我们长按时会触发。
Text("Hello, World!")
.onLongPressGesture {
print("Long pressed!")
}
边栏推荐
- 【593. Valid Square】
- ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
- [ACTF2020 新生赛]Exec 1
- 240. 搜索二维矩阵 II
- leetcode-593:有效的正方形
- 网站ping端口的操作方法和命令介绍
- C#笔记 之 Oracle.ManagedDataAccess包的安装及配置
- The younger brother asked: Is the work of a programmer a day’s work of code?
- 剑指 Offer II 097. 子序列的数目
- 7 行代码搞崩溃 B 站,原因令人唏嘘!
猜你喜欢
随机推荐
Analysis of Crypto in Pi 2
怎么实现您的个人知识库?
容器网络硬核技术内幕 (24) 知微知彰,知柔知刚 (上)
七个易犯的 IT 管理错误—以及如何避免
初识网络的简单概念
VSCode配置终端为系统命令行
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
336. 回文对
RedisJson 横空出世!
QT安装、创建项目与调试,在VS中的使用:手把手教程
240. 搜索二维矩阵 II
微信小程序 30 自定义模板和获取用户登录凭证
The sword refers to Offer II 097. Number of subsequences
模型推理模板
Setinel 原理简介
C# 窗体与子线程数据交互
笔记:fgets函数详解
容器网络硬核技术内幕 (小结-中)
Dry goods!Cooperative Balance in Federated Learning
Qualcomm WLAN framework learning (31) -- Power save