iOS aspect ratio constraint breaks on iOS7, works on iOS8

前端 未结 6 1758
春和景丽
春和景丽 2021-02-04 18:37

In my app, I have setup a UIView\'s constraints in a way where its height gets calculated from its width using the aspect ratio constraint. It works perfectly on iOS8 with every

6条回答
  •  广开言路
    2021-02-04 19:34

    This is one annoying bug, cost me a lot of hours as well. I had the exact same problem, the app was working fine in iOS 8 but crashed in iOS 7.1. The problem was an aspect ratio constraint on a scroll view. After trying out a lot of different things, this finally solved the problem:

    The crash seems to be the result of a floating point calculation that fails at some point. In my case, I had defined an aspect ratio of 16:9 or rather 9:16, which amounts to 0.5625. Changing the multiplier from 0.5625 to 0.5624 fixed the problem, no more crashes have appeared since then.

提交回复
热议问题