autolayout - sizeClass 学习 ~ two

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.

Alignment Rectangles

作为开发者创建复杂的视图,他们可能引进了可视化的修饰例如阴影,外部的亮彩,反射,雕刻线。当他们做的时候,这些功能往往绘制到影像艺术,而不是通过图层或子视图添加,不像Frames,一个视图的 alignment rectangle 应该被限制到一个核心的可视化元素。他们的大小应该不会因为新的项目元素被添加到视图而受到影响。如左图1-11所示,它表示了一个被绘制成阴影和徽章的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值