欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

withAnimation(_:_:) 动画(SwiftUI中文文档手册)

程序员文章站 2022-03-16 16:13:09
...

withAnimation(:????

返回使用提供的动画重新计算视图主体的结果。

func withAnimation<Result>(_ animation: Animation? = .default, _ body: () throws -> Result) rethrows -> Result

讨论区

此函数将给定设置Animation为animation线程current 的属性Transaction。

实战代码

 withAnimation(.spring()){
                            self.offset = .zero
                    }

技术交流

QQ:3365059189
SwiftUI技术交流QQ群:518696470