0

I am using SwiftUI to build an app and when I tested it on iPad and iPhone, there is a difference. My views are different in iPad and it is showed by tapping back button as a hamburger. The thing is that I have 3 tabs and my first tab is okay. However, 2nd and third tabs are having this issue. I was wondering if you could help me fix it.

Here is a picture:

This is the iPad view. This is the iPhone view.

Yonus
  • 233
  • 2
  • 12

1 Answers1

1

Are you using a NavigationView? By default those layout differently on iPad and iPhone. If that's the case, try adding this modifier to your NavigationView:

.navigationViewStyle(StackNavigationViewStyle())
mightknow
  • 256
  • 3
  • 14
  • Thanks a lot. Got fixed. Seems like I had done it for one of my tabs but not the rest. :)) – Yonus Nov 24 '20 at 00:00
  • [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. – Yonus Nov 24 '20 at 00:12
  • (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ( "", "", " – Yonus Nov 24 '20 at 00:13
  • _UIUCBKBSelectionBackground:0x7ff2f7d64560.bottom == _UIButtonBarButton:0x7ff2f7d63120.bottom - 6 (active)>" ) Will attempt to recover by breaking constraint Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful. – Yonus Nov 24 '20 at 00:13
  • Well, I have a text field there and when I tap on that to type, I get this thing in the console for iPad. Do you have any idea of what is it ? – Yonus Nov 24 '20 at 00:14
  • There's no way I'd be able to tell exactly without seeing code, but that's a UIKit error. If you're using only SwiftUI (with no explicit UIKit code), then there's probably an issue with how you're nesting views inside of each other, possibly the TabView and NavigationView. – mightknow Nov 24 '20 at 00:28
  • I am pasting my code here but for some unknown reasons it can't identify it as code. Is there any way I can give you the code? – Yonus Nov 24 '20 at 00:46
  • You can edit your original post to include it, or you can ask it as a new question entirely. I recommend the second option because it's kind of a separate issue than the original question. Also, that way you're more likely to get more people looking at it than just me. – mightknow Nov 24 '20 at 01:00