vikzilla
vikzilla

Reputation: 4138

Today Widget view moves / constraints unstable

My today widget uses nested stackviews to lay itself out. However, there is slight movement / unintentional resizing when the window is dragged and also when users interact with the view:

enter image description here

The stackview is simply pinned to all four sides of the super view:

enter image description here

I'm not sure if I'm missing something specific to Today Widgets, or possibly UIStackview that is causing this movement to occur.

Upvotes: 1

Views: 278

Answers (1)

vikzilla
vikzilla

Reputation: 4138

I worked around this by avoiding the use of pins on my view (i.e. pinning it 0 points from any side of its super view).

Rather, I rely on other types of constraints. For example, setting my view to share trailing edges or leading edges with its superview, rather than pinning it 0 points to either side of the superview.

Also handy is using equal widths w/ an adjusted multiplier for more flexibility.

Without any pins, the view no longer jerks / resizes unexpectedly. I recommend testing on a device, as it seems to sometimes slip up on the simulator but not on the device.

Upvotes: 1

Related Questions