当前位置:网站首页>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("边栏推荐
- .NET MAUI 性能提升
- MySQL安装常见报错处理大全
- Technology sharing | packet capturing analysis TCP protocol
- How much do you know about excel formula?
- . Net Maui performance improvement
- Software design - "high cohesion and low coupling"
- EasyUI learn to organize notes
- 对比学习之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
- 在我有限的软件测试经历里,一段专职的自动化测试经验总结
- Electron adding SQLite database
猜你喜欢

对比学习之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments

Leetcode - interview question 17.24 maximum submatrix

Test the foundation of development, and teach you to prepare for a fully functional web platform environment

Stm32f1 and stm32subeide programming example -max7219 drives 8-bit 7-segment nixie tube (based on SPI)

竟然有一半的人不知道 for 与 foreach 的区别???

Technology sharing | packet capturing analysis TCP protocol

一度辍学的数学差生,获得今年菲尔兹奖

In SQL, I want to set foreign keys. Why is this problem

The road to success in R & D efficiency of 1000 person Internet companies

Some opinions and code implementation of Siou loss: more powerful learning for bounding box regression zhora gevorgyan
随机推荐
What development models did you know during the interview? Just read this one
Various uses of vim are very practical. I learned and summarized them in my work
VIM command mode and input mode switching
Programming examples of stm32f1 and stm32subeide -315m super regenerative wireless remote control module drive
对比学习之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
正在运行的Kubernetes集群想要调整Pod的网段地址
Reasons for the failure of web side automation test
In SQL, I want to set foreign keys. Why is this problem
一度辍学的数学差生,获得今年菲尔兹奖
网络协议 概念
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
Audit migration
【愚公系列】2022年7月 Go教学课程 005-变量
sql里,我想设置外键,为什么出现这个问题
Verilog design responder [with source code]
The running kubernetes cluster wants to adjust the network segment address of pod
聊聊SOC启动(十一) 内核初始化
相机标定(1): 单目相机标定及张正友标定基本原理
STM32F1与STM32CubeIDE编程实例-MAX7219驱动8位7段数码管(基于SPI)
【最短路】Acwing1128信使:floyd最短路