小智 7
完整代码:
struct SampleDetails: View {
@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
var btnBack: some View {
Button(action: {self.presentationMode.wrappedValue.dismiss()}) {
HStack {
Image("ic_back") // set image here
.aspectRatio(contentMode: .fit)
.foregroundColor(.white)
Text("Go back")
}
}
}
var body: some View {
List {
Text("sample code")
}
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: btnBack)
}
}
Run Code Online (Sandbox Code Playgroud)
如需更多说明,请单击此处。
| 归档时间: |
|
| 查看次数: |
2980 次 |
| 最近记录: |