Swiftui 导航视图/导航链接自定义转换方向
我正在尝试使用Swiftui 导航视图/导航链接自定义转换方向,swiftui,swiftui-navigationlink,Swiftui,Swiftui Navigationlink,我正在尝试使用NavigationLink从屏幕底部加载视图,而不是从右侧过渡,但是“明显”的方法(使用.transition(.move(edge:.bottom)))似乎没有任何效果 下面是导航视图的内部: List { ForEach(self.message, id: \.self) { message in HStack(alignment: .center) { MessageListCell(....) } }
NavigationLink
从屏幕底部加载视图,而不是从右侧过渡,但是“明显”的方法(使用.transition(.move(edge:.bottom))
)似乎没有任何效果
下面是导航视图的内部:
List {
ForEach(self.message, id: \.self) { message in
HStack(alignment: .center) {
MessageListCell(....)
}
}
}
和MessageListCell
:
var body: some View {
HStack {
VStack(alignment: .leading, spacing: 0) {
Text(person.firstName).lineLimit(1)
.foregroundColor(.main)
}
Spacer()
NavigationLink(destination: MessageDetail(otherPerson: otherPerson,
subject: subject,
profileHandler: { ProfileReducer($0) })
.transition(.move(edge: .bottom)),
tag: 1, selection: $action) {
NextButton("Proceed")
}
}
}
点击NextButton
可从屏幕右侧而不是底部持续切换。我已经尝试了以上的各种方法,但我开始认为转换
可能不是正确的方法。目前,使用导航视图
无法实现这一点,所以要么等到下一个主要版本的SwiftUI出现(希望它会出现),要么创建自定义导航堆栈,因此,实现您喜欢的任何转换,例如在topic@Asperi中,自己实现堆栈也意味着我会释放一些东西,比如回扫手势,对吗?