在 SwiftUI 中使用 TabView 时,是否可以修改选项卡选择之间的转换?目前,当选择不同的选项卡时,转换非常突然;居然瞬间突然,哎哟。
例如,给定以下情况:
TabView {
Text("The First Tab")
.tabItem {
Image(systemName: "1.square.fill")
Text("First")
}
Text("Another Tab")
.tabItem {
Image(systemName: "2.square.fill")
Text("Second")
}
Text("The Last Tab")
.tabItem {
Image(systemName: "3.square.fill")
Text("Third")
}
}
如何添加类似 .transition(AnyTransition.opacity.combined(with: .slide)) 的内容
Thanks !
您可以将 .animation 属性添加到 TabView 中。
TabView {
// code here
}
.animation(*animation type*)
您拥有的基本动画类型是.default
, .easeIn
, .easeOut
, .easeInOut
and .linear
.
希望这可以帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)