当前位置:网站首页>Swiftui tutorial how to realize automatic scrolling function in 2 seconds
Swiftui tutorial how to realize automatic scrolling function in 2 seconds
2022-07-07 11:45:00 【Knowledge fatness】
Use SwiftUI It's amazing to develop . It does make it possible to implement some cool functions in just a few lines of code . today , Let's realize automatic scrolling . When you create a chat application , This technique is particularly useful . I will explain it as briefly as possible .
Prepare your UI
struct AutoScrollList: View {
var body: some View {
VStack {
Button("Scroll to 100") {
}
List(1...500, id: \.self) { index in
Text("\(index)")
}
}
}
}
I implemented a very simple list with a button . When the user clicks the button , I want my list ( Scroll view ) Scroll to a position . How do I achieve it ?
Wrap the entire view ScrollViewReader
struct AutoScrollList: View {
var body: some View {
ScrollViewReader { proxy in
VStack {
Button("
边栏推荐
- 常用sql语句整理:mysql
- Stm32f1 and stm32subeide programming example -max7219 drives 8-bit 7-segment nixie tube (based on SPI)
- QT implements the delete method of the container
- R language Visual facet chart, hypothesis test, multivariable grouping t-test, visual multivariable grouping faceting boxplot, and add significance levels and jitter points
- 问下flinkcdc2.2.0的版本,支持并发,这个并发是指多并行度吗,现在发现,mysqlcdc全
- TDengine 社区问题双周精选 | 第二期
- STM32入门开发 采用IIC硬件时序读写AT24C08(EEPROM)
- Talk about SOC startup (VI) uboot startup process II
- Excel公式知多少?
- 简单介绍一下闭包及它的一些应用场景
猜你喜欢
禁锢自己的因素,原来有这么多
Talk about SOC startup (x) kernel startup pilot knowledge
关于在云服务器上(这里用腾讯云)安装mysql8.0并使本地可以远程连接的方法
Complete collection of common error handling in MySQL installation
Suggestions on one-stop development of testing life
About how to install mysql8.0 on the cloud server (Tencent cloud here) and enable local remote connection
Technology sharing | packet capturing analysis TCP protocol
Onedns helps college industry network security
CMU15445 (Fall 2019) 之 Project#2 - Hash Table 详解
Leetcode - interview question 17.24 maximum submatrix
随机推荐
博客搬家到知乎
【愚公系列】2022年7月 Go教学课程 005-变量
sink 消费 到 MySQL, 数据库表里面已经设置了 自增主键, flink 里面,如何 操作?
Suggestions on one-stop development of testing life
正在运行的Kubernetes集群想要调整Pod的网段地址
STM32入门开发 采用IIC硬件时序读写AT24C08(EEPROM)
自动化测试框架
Stm32f1 and stm32subeide programming example -max7219 drives 8-bit 7-segment nixie tube (based on SPI)
Verilog design responder [with source code]
【神经网络】卷积神经网络CNN【含Matlab源码 1932期】
QT implements the delete method of the container
Internet Protocol
R language uses image of magick package_ Mosaic functions and images_ The flatten function stacks multiple pictures together to form a stack layers on top of each other
Android interview knowledge points
问下flinkcdc2.2.0的版本,支持并发,这个并发是指多并行度吗,现在发现,mysqlcdc全
STM32F1与STM32CubeIDE编程实例-315M超再生无线遥控模块驱动
正在運行的Kubernetes集群想要調整Pod的網段地址
Excel公式知多少?
SwiftUI Swift 内功之 Swift 中使用不透明类型的 5 个技巧
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?