ericberman / MyFlightbookiOS

Repository for the iOS app for MyFlightbook
GNU General Public License v3.0
12 stars 4 forks source link

Split View on iPads doesn’t resize the layout properly #307

Closed zartom closed 1 year ago

zartom commented 1 year ago

It happens, as far as i could tell, when MFB is the second one that opens, on a flight activity (maybe just an ongoing one) IMG_2363

ericberman commented 1 year ago

Huh.

2 comments: a) I have to rant about how insanely awful, convoluted, and stupid Apple's "constraints based layout" engine is. You don't say what goes where, you express a set of rules that must be met (and each object on the screen requires multiple rules) It's a freaking pointless nightmare. HTML was right there. So were other XML layouts (e.g., which Android uses, which work absolutely fine). (And all of those support flowing/wrapping, which CBL doesn't). But could Apple use any of that? Nooooo...they had to invent something that is obscenely difficult to use and to debug. (But I suppose they make up for that by providing way less functionality and a miserable UI for dealing with it?)

Anyhow....the result of that is: I don't do the layout. I specify the constraints and Apple does the layout based on those constraints. So I'm not quite sure what I could do here. But, perhaps more importantly,...

b) ...I'm not able to reproduce this, whether I start with full-screen MyFlightbook and add something next to it or if I start with full-screen something and add MyFlightbook next to it. Either way, I'm getting a reasonable layout (see below) Can you give me reliable repro steps? Also, what happens if you rotate the iPad?

Screenshot 2023-07-04 at 10 19 08 AM
zartom commented 1 year ago

So I launched an app (Google search app) and then MFB in split mode. The latter opened on the recent flights tab and displayed correctly. I started recording a new flight, then closed both apps and repeated the steps. MFB now opened on the new flight tab with the ongoing recording and the layout was broken again

zartom commented 1 year ago

While the layout was displayed incorrectly repeated rotations of the device made it completely unusable. It pushed all the displayed elements out of boundaries and ended in a black screen. I'll send you the screen capture

ericberman commented 1 year ago

Weird, still can't reproduce that. Honestly suspect it's an iOS bug. (How could that possibly be?)

ericberman commented 1 year ago

Wow, I can reproduce that...sometimes! I can't figure out what triggers and doesn't trigger it. Note that if you switch the from the split-screen paired app to another app, then switch back to the split screen, it fixes itself.

I'll have to dive into Apple's pathetically useless docs to see if there is something I'm supposed to do, but as far as I can tell it's an apple bug, simply because what I currently do to support split screen is effectively...declare upfront that I support all orientations. That's literally all that's is required. The fact that navigating away and back seems to fix it tells me that I am indeed supporting it; it's the same code both times on my end...

ericberman commented 1 year ago

And google to the rescue. https://stackoverflow.com/questions/61585039/why-are-auto-layout-constraints-not-properly-installed-when-my-app-loads-in-spli. Looks like it happens if the app is NOT already running and needs to be loaded; if MyFlightbook is already running, everything seems to work. The issue is that I'm setting the window frame - something that I was supposed to do years and years ago, but it seems I no longer need to do. Sigh. Will roll this fix into the next update.

ericberman commented 1 year ago

Oh, and this is a perfect example of how Apple breaks things over time with pathetic documentation that never mentions stuff like this...