Alignment Rectangles: 这个概念在autoLayout中非常常见,所以特开一贴
Image Embellishments
When you include embellishments in your pictures such as shadows, sparkles, badges, and other items that extend beyond the image’s core content, an image’s natural size may no longer reflect the way you want Auto Layout to handle layout. In Auto Layout, constraints determine view size and placement, using a geometric element called an alignment rectangle. The UIKit API calls help you control that placement.
图像点缀
当你修饰你的相片例如阴影,闪耀效果,徽章和其他项目这超过了图片的核心内容。一个图像的原始大小可能不会反映出你想利用自动布局去处理的方式。在自动布局中,约束决定了视图的大小和布局,利用了称为-alignment rectangle 的几何元素。UIKit API调用帮你控制布局。Alignment Rectangles
As developers create complex views, they may introduce visual ornamentation such as shadows, exterior highlights, reflections, and engraving lines. As they do, these features are often drawn onto image art rather than being added through layers or subviews. Unlike frames, a view’s alignment rectangle should be limited to a core visual element. Its size should remain unaffected as new items are drawn onto the view. Consider the left side of Figure 1-11. It shows a view drawn with a shadow and a badge. When laying out this view, you want Auto Layout to focus on aligning just the core element—the blue rectangle—and not the ornamentation.