1

我正在尝试使用带有自动布局的 UIScrollView。我根本无法让它像使用支柱和弹簧那样工作。我想使用自动布局,因为这是前进的道路,但令人沮丧的是,Apple 只是放了一个小文档,甚至没有详细解释这一点。我想声明我正在使用 IB,而不是在代码中表达我的观点(现在这不是一个选择)。

这是我的视图层次结构:

-UIViewController

    -UIView (the base view)

        -UIScrollView [Contraints: topEdge-SuperView-0, leftEdge-SuperView-0, bottomEdge-SuperView (bottom layout guide sometimes)-0, rightEdge-SuperView-0, and sometimes CenterX-Superview-0]

            -UIView (the content View) [topEdge-SuperView-0, leftEdge-SuperView-0, bottomEdge-SuperView-0, rightEdge-SuperView-0, and also tried CenterX and centerY seperately]

                -The Actual Content [Constrained to the super view]

我认为这就是 Apple 根据他们的文档所说的带有 UIScrollView 和 Autolayout 的纯 Autolayout 设置。请不要让我参考那个文件,我已经读过很多次了。现在我也继续做

translatesAutoresizingMaskIntoConstraints = NO 

但结果是相同的,无论上述选项是真还是假。

结果:没有卷轴……!!

有没有办法解决这种疯狂?我试图复制 rmayoff 在他在 Youtube 上的视频中所做的事情(也请不要向我提及),但不……什么都没有……!!

4

0 回答 0