twodayslate / NetUtils

WHOIS, DNS, ping, view source, and more!
https://itunes.apple.com/us/app/netutils/id1434360325?mt=8
Other
34 stars 6 forks source link

Text overlap on navigation bar for Ping tab #70 #92

Closed AhmadAzam closed 2 years ago

AhmadAzam commented 2 years ago

ScrollView with bg color embedded in navigation view, overlap of scrollView on navigation issue correction. #70

twodayslate commented 2 years ago

Related? https://www.hackingwithswift.com/forums/swiftui/navigation-title-and-scrollview-issue/7236

twodayslate commented 2 years ago
diff --git a/ec3730/Controllers/PingViewController.swift b/ec3730/Controllers/PingViewController.swift
index 744d2d5..d8aa190 100644
--- a/ec3730/Controllers/PingViewController.swift
+++ b/ec3730/Controllers/PingViewController.swift
@@ -307,7 +307,10 @@ struct PingSwiftUIViewController: View {
                                     }
                                 })
                             }.padding()
-                        }.background(Color.black.ignoresSafeArea(.all, edges: .horizontal)).onTapGesture(perform: {
+                        }
+                        .background(Color.black.ignoresSafeArea(.all, edges: .horizontal))
+                        .padding(.top, 0.15)
+                        .onTapGesture(perform: {
                             dismissKeyboard = UUID()
                         })
                     }
@@ -328,7 +331,8 @@ struct PingSwiftUIViewController: View {
                         }.padding(.horizontal).padding([.vertical], 6)
                     }.background(VisualEffectView(effect: UIBlurEffect(style: .systemMaterial)).ignoresSafeArea(.all, edges: .horizontal)).ignoresSafeArea()
                 }.navigationBarTitle("Ping", displayMode: .inline)
-            }.toolbar(content: {
+            }
+            .toolbar(content: {
                 ToolbarItem(placement: .navigationBarLeading, content: {
                     Button(action: { showSettings.toggle() }, label: {
                         Image(systemName: "gear")
twodayslate commented 2 years ago

Or just clip it? https://stackoverflow.com/a/71911309

AhmadAzam commented 2 years ago

https://www.hackingwithswift.com/forums/swiftui/navigation-title-and-scrollview-issue/7236

Yes clipping will also work for sure.

AhmadAzam commented 2 years ago

https://www.hackingwithswift.com/forums/swiftui/navigation-title-and-scrollview-issue/7236

Yes clipping will also work for sure.

I saw other lengthy solutions as well. But clipping and padding are the simplest one.

twodayslate commented 2 years ago

Alright. Let's either just change the padding number to 0.15 or use clipped. I don't think it is necessary to change the background. Please confirm that the background doesn't break on a notch etc.

AhmadAzam commented 2 years ago

Alright. Let's either just change the padding number to 0.15 or use clipped. I don't think it is necessary to change the background. Please confirm that the background doesn't break on a notch etc.

I've checked both padding 0.15 or 1 and clipped both work the same, work well on notch devices as well. Changed padding to clipped, it will help understanding code in future.

twodayslate commented 2 years ago

.clipped won't work. The notch messed up the background. Try landscape

twodayslate commented 2 years ago

The full solution is probably something like https://stackoverflow.com/a/65218077