实战需求
SwiftUI List 设置行点击高亮动画效果?
本文价值与收获
看完本文后,您将能够作出下面的界面
看完本文您将掌握的技能
- 掌握background
- 掌握onTagGesture
- 掌握animation
- 掌握延时设置动画
基础知识
List
一个容器,用于显示排列在单列中的数据行。
struct List<SelectionValue, Content> where SelectionValue : Hashable, Content : View
background(_:alignment:)
将给定视图分层放置在该视图之后。
func background<Background>(_ background: Background, alignment: Alignment = .center) -> some View where Background : View
参量
- backgroud 背景
在该视图后面绘制的视图。 - aligment对准
用于定位背景视图的中心默认值的对齐方式。