Hi,
My app has gotten rejected four times for this problem so bear with me....
A few weeks ago, I posted that I was having problems with my app showing a blank screen when someone went into Landscape Mode.
Someone suggested using .navigationViewStyle(StackNavigationViewStyle()) which seemed to work the first few times, and then stopped working after I sent it to have it reviewed.
I'm still having the same problem and it is becoming maddening.
Here's the code in question (again):
import SwiftUI
import Foundation
struct ContentView: View {
var body: some View {
NavigationView() {
List (){
Section(header: Text("Main Information"))
{
NavigationLink(destination: Introduction())
{
Image(systemName: "exclamationmark.circle").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Introduction").tag(1)
.font(.headline)
}
NavigationLink(destination: Definitions())
{
Image(systemName: "questionmark.circle").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Definitions").tag(2)
.font(.headline)
}
NavigationLink(destination: TypesOfAbuse())
{
Image(systemName: "table").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Types").tag(2)
.font(.headline)
}
NavigationLink(destination: Effects())
{
Image(systemName: "exclamationmark.circle").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Effects").tag(2)
.font(.headline)
}
NavigationLink(destination: WhereAbuseOccures())
{
Image(systemName: "questionmark.circle").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Where it Occurs").tag(3)
.font(.headline)
}
NavigationLink(destination: RecognizingChildAbuse())
{
Image(systemName: "xmark.circle").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Recognizing Abuse").tag(4)
.font(.headline)
}
NavigationLink(destination: ReportingSuspectedChildAbuse())
{
Image(systemName: "phone.arrow.right").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Reporting Child Abuse").tag(5)
.font(.headline)
}
NavigationLink(destination: ChildrenCanBeHelped())
{
Image(systemName: "person.circle").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Children Can Be Helped").tag(7)
.font(.headline)
}
NavigationLink(destination: CountryMenu())
{
Image(systemName: "phone.circle").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Phone Numbers").tag(8)
.font(.headline)
}
NavigationLink(destination: Search())
{
Image(systemName: "magnifyingglass.circle").resizable()
.frame(width: 32, height: 32, alignment: .leading)
Text("Search").tag(9)
.font(.headline)
}
}
Section(header: Text("App Information & Support"))
{
NavigationLink(destination: About())
{
Text("About").fontWeight(.bold)
}
NavigationLink(destination: Support())
{
Text("Support").fontWeight(.bold)
}
}
Section(header: Text("Version"))
{
Text("1.0").fontWeight(.bold)
}
}
.navigationViewStyle(StackNavigationViewStyle())
.navigationBarTitle(Text("Child Abuse"))
.listStyle(GroupedListStyle())
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
Group {
ContentView()
.previewDevice("iPhone XS Max")
.environment(\.colorScheme, .light)
}
}
}
}
extension View {
func phoneOnlyStackNavigationView() -> some View {
if UIDevice.current.userInterfaceIdiom == .phone {
return AnyView(self.navigationViewStyle(StackNavigationViewStyle()))
} else {
return AnyView(self)
}
}
}
As you can see on line 126, I have the suggested option.
By the way, lines 149 - 157 were from a website to try and get this working, but to no advail.
Thanks,
Dan Uff