Layout Constraint Conflicts in Default Today Widget

前端 未结 2 1944
你的背包
你的背包 2021-01-12 16:27

I have observed a very strange behavior regarding Autolayout in the Today Widget I just created for my app. Trying to get to the root of the problem I ended up creating a pl

2条回答
  •  没有蜡笔的小新
    2021-01-12 17:09

    In some of Apple's stock UIView subclasses, they are instantiated with a size of zero. You need to configure your NSLayoutConstraints so that they can properly react to this initial size. In the past, I've made top or bottom constraints an inequality so that the rest of the constraints may size themselves correctly and not break the layout.

    Ex: Make your bottom constraint () a LessThanOrEqualTo with a constant value of 8.0.

提交回复
热议问题