UIView documentation, Apple describes alignment rects:
The constraint-based layout system uses alignment rectangles to align views, rather than their frame. This allows custom views to be aligned based on the location of their content while still having a frame that encompasses any ornamentation they need to draw around their content, such as shadows or reflections.
At first glance, this feature feels unnecessary: views can draw outside their bounds seemingly without performance issues. However, the differentiation between frame and alignment is a powerful, and easily overlooked, feature in Auto Layout.
Continue reading “Alignment rects in Auto Layout views”
There are two different uses for the
shadowPath property on
- Improving the performance of having a shadow
- Creating shadows that don’t match the contents of the view. Check out Apple’s Using Shadow Path for Special Effects.
For performance reasons, always set a
shadowPath. This is a substantial improvement, especially if the view changes position via animation or presence in a scroll view.
Continue reading “Better shadow performance on views”
isLayoutMarginsRelativeArrangement allows insets similar to margin constraints on subviews in a
Continue reading “Layout margins within a UIStackView”