当我按下多个视图时,导航栏中会显示多个后退按钮。
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink(destination:SecView()) {
Text("Primo")
}
}
}
}
struct SecView: View {
var body: some View {
NavigationView {
NavigationLink(destination:TerView()) {
Text("Secondo")
}
}
}
}
struct TerView: View {
var body: some View {
Text("Hello World!")
}
}
Run Code Online (Sandbox Code Playgroud)
我希望每个视图只有一个后退按钮。
这是问题的屏幕截图。
我在 SwiftUI 中的 NavigationView 遇到问题,我添加了此代码来隐藏导航并且工作正常,但是在滚动视图时出现粘性标题如何删除它?谢谢!!
NavigationView {
...
}
.navigationBarTitle("")
.navigationBarHidden(true)
.navigationBarBackButtonHidden(true)
Run Code Online (Sandbox Code Playgroud)
您好,我在 SwiftUi 中遇到图像问题,我有这样的布局:

图像和健身是可点击的,但是当我单击健身时打开图像页面。
这是我的代码:
VStack {
HStack(alignment: .center) {
NavigationLink(destination: FullNewsListView(category: "Fitness")) {
Text("Fitness")
.foregroundColor(Color("#29B1B3"))
.font(Font.custom("AvenirNextLTPro-Bold", size: 20))
Image("forward_blue")
}
Spacer()
}
.padding(.bottom, 10)
VStack(alignment: .leading, spacing: 10) {
HStack {
URLImage(URL(string: "http://myPhoto")!) { proxy in
proxy.image
.renderingMode(.original)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(minWidth: 0, maxWidth: .infinity)
.frame(height: 180)
.cornerRadius(12)
.clipped()
}
}
HStack {
Text(api.newsFitnessHome.news!.title)
.foregroundColor(.black)
.font(Font.custom("AvenirNextLTPro-Demi", size: 15))
.opacity(0.8)
.lineSpacing(5)
.lineLimit(2)
.fixedSize(horizontal: false, vertical: true)
Spacer()
}
}
}
.padding(.horizontal, 30)
Run Code Online (Sandbox Code Playgroud)