Constraints not working when rotating to different orientation

In storyboard, I have a UICollectionView whose height needs to be different when in portrait mode and when in landscape mode.

So I have two different height constraints on it, one for each size class:

在这里输入图像描述 ----- and ----- 在这里输入图像描述

The separate height constraints look like this (they use a multiplier to set the collection-view's height relative to the height of the super view):

在这里输入图像描述 --- and --- 在这里输入图像描述

When the app first runs, the constraint works (whether the app starts off in portrait or landscape). However, the problem is when rotating the device to the other orientation: nothing changes. The constraint for the other size class does not take effect, and the view remains the same size it was when the app first loaded.

I am unsure as to why my size independent size-constraints aren't kicking in when the device is rotated.

链接地址: http://www.djcxy.com/p/58388.html

上一篇: 更新帧时,UIToolbar项不会移动

下一篇: 旋转到不同方向时约束不起作用