HarshilShah / DeckTransition

A library to recreate the iOS Apple Music now playing transition
MIT License
2.19k stars 168 forks source link

Rotation breaks the layout #106

Open Sjoerdjanssenen opened 5 years ago

Sjoerdjanssenen commented 5 years ago

In my app I have a UISplitViewController as the base. Now, when I present a UIViewController as a card on top of it, the view will look like this.

image

However, when I rotate the device and then rotate back, the layout breaks and it will look like this.

image

When I then rotate once more and once more back, the app will crash, throwing this:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Multiplier is not finite!  That's illegal.  multiplier:-inf'
*** First throw call stack:
(
0   CoreFoundation                      0x000000010759a6fb __exceptionPreprocess + 331
1   libobjc.A.dylib                     0x0000000106b3eac5 objc_exception_throw + 48
2   CoreFoundation                      0x000000010759a482 +[NSException raise:format:arguments:] + 98
3   Foundation                          0x000000010658c927 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4   Foundation                          0x000000010679255e -[NSLayoutConstraint _setMultiplier:] + 336
5   Foundation                          0x000000010679949f +[NSLayoutConstraint constraintWithAnchor:relatedBy:toAnchor:multiplier:constant:] + 575
6   DeckTransition                      0x000000010319992b $s14DeckTransition0A22PresentationControllerC29updateSnapshotViewAspectRatio33_71FA53A27BEAE2D482201C2CF371A196LLyyF + 1931
7   DeckTransition                      0x000000010319a09a $s14DeckTransition0A22PresentationControllerC31containerViewWillLayoutSubviewsyyF + 298
8   DeckTransition                      0x000000010319a644 $s14DeckTransition0A22PresentationControllerC31containerViewWillLayoutSubviewsyyFTo + 36
9   UIKitCore                           0x0000000111070905 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1229

Any ideas as to what could be causing this? I have a feeling it's a layout issue in the library, but I have no clue where to start looking...

HarshilShah commented 5 years ago

Sorry for the late response. Just scanning the crashlog and the bug seems related to the snapshot view. I’m planning to get rid of that entirely in an upcoming release which should fix the issue, but in the meantime it’d be great to have a minimally reproducible example based on the project’s Example app so I can confirm that the bug is indeed getting fixed with the changes.

ifamirhasan commented 4 years ago

Any solution for rotation ?