ios-navigationview

Background color on Navigation Bar is not set when my SwiftUI based app is launched in landscape mode

限于喜欢 提交于 2020-07-22 14:12:42
问题 I am working with a SwiftUI based app that relies on a NavigationView to transition from screens. I have a requirement to set the background color on the navigation bar and have found code that makes this work most of the time. When the app is launched in portrait mode, everything works properly across rotations. However, when the app is launched in landscape mode, the bar is the default gray and only updates after the first rotation. Below, I have the minimal amount of code to recreate my

Bug display with SwiftUI

一个人想着一个人 提交于 2020-06-29 04:07:05
问题 I have a SwiftUI app where sometimes a bug in the display appears. I have a NavagigationView that sould display like this : But sometimes in devices it appears like this(bug display at the top of the page): I don't understand where this comes from. EDIT: Here is the code of this page: struct FilesAdminView: View { @EnvironmentObject var session : SessionStore @ObservedObject var fileAdminViewModel : FileAdminViewModel = FileAdminViewModel() @State var showFilterPopUp : Bool = false @State var

SwiftUI NavigationLink immediately navigates back

六眼飞鱼酱① 提交于 2020-06-27 17:58:05
问题 I am using SwiftUI to create NavigationLinks from rows to detail views in a NavigationView (similar to what is being done in the tutorial https://developer.apple.com/tutorials/swiftui/building-lists-and-navigation). However, when I test in my app, the NavgiationLink immediately navigates back from the detail view to the previous view after being tapped (the detail view only shows up for only a second). Here's the code: struct ItemsView: View { var body: some View { NavigationView { VStack {

SwiftUI transition from modal sheet to regular view with Navigation Link

天大地大妈咪最大 提交于 2020-06-17 09:51:09
问题 I'm working with SwiftUI and I have a starting page. When a user presses a button on this page, a modal sheet pops up. In side the modal sheet, I have some code like this: NavigationLink(destination: NextView(), tag: 2, selection: $tag) { EmptyView() } and my modal sheet view is wrapped inside of a Navigation View. When the value of tag becomes 2, the view does indeed go to NextView(), but it's also presented as a modal sheet that the user can swipe down from, and I don't want this. I'd like

SwiftUI how to set image for NavigationBar titleView like in UIKit?

无人久伴 提交于 2020-05-29 04:05:49
问题 I want to set an image in the titleView of NavigationBar in SwiftUI, as we do in UIKit navigationItem.titleView = UIImageView(image: UIImage(named: "logo")) this is how we do it in UIKit. anyone know how to do it? 回答1: Here's how to do it: Add SwiftUIX to your project. Set your custom title view via View.navigationBarTitleView(_:displayMode:) Example code: struct ContentView: View { public var body: some View { NavigationView { Text("Hello World") .navigationBarTitleView(MyView()) } } } 回答2:

SwiftUI how to set image for NavigationBar titleView like in UIKit?

余生颓废 提交于 2020-05-29 04:04:25
问题 I want to set an image in the titleView of NavigationBar in SwiftUI, as we do in UIKit navigationItem.titleView = UIImageView(image: UIImage(named: "logo")) this is how we do it in UIKit. anyone know how to do it? 回答1: Here's how to do it: Add SwiftUIX to your project. Set your custom title view via View.navigationBarTitleView(_:displayMode:) Example code: struct ContentView: View { public var body: some View { NavigationView { Text("Hello World") .navigationBarTitleView(MyView()) } } } 回答2:

SwiftUI how to set image for NavigationBar titleView like in UIKit?

旧城冷巷雨未停 提交于 2020-05-29 04:04:10
问题 I want to set an image in the titleView of NavigationBar in SwiftUI, as we do in UIKit navigationItem.titleView = UIImageView(image: UIImage(named: "logo")) this is how we do it in UIKit. anyone know how to do it? 回答1: Here's how to do it: Add SwiftUIX to your project. Set your custom title view via View.navigationBarTitleView(_:displayMode:) Example code: struct ContentView: View { public var body: some View { NavigationView { Text("Hello World") .navigationBarTitleView(MyView()) } } } 回答2: