Inconsistent Today Widget behavior breaks subview's height constraints

本小妞迷上赌 提交于 2019-12-02 00:45:48

Try avoiding the use of pins.

For positioning, rely on aligning your view to the superview's leading, trailing, top, or bottom edges.

For sizing, try setting your view to have equal heights or widths with the superview. And adjusting the multiplier as needed.

This solved auto layout inconsistencies I was experiencing in a Today Widget.

Updated w/ screenshot:

See above, I am using the align menu (not the pin menu). I select both the view I am trying to constrain, along with the all encasing superview, and tell the prior to share (or, align with) trailing and bottom edges.

I know this is not how Apple may demonstrate it, however it is a workaround that avoids the bugs that occur when using pins with Today Widgets.

Update #2 - And here is all the constraints (including height and width):

The bug must be related to the inferred sizing of a view that is entirely pinned, because when I set the height and width of my view to be relative to its superview (rather than having it be inferred), the bug does not occur.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!