Attributes Inspector: how to use “Stretching”

ⅰ亾dé卋堺 提交于 2019-12-04 22:56:58

This blog post Karol seems to explain it pretty well. - http://macoscope.com/blog/stretchable-images-using-interface-builder/

Stretching properties are pretty simple (I don't think so, but the articles does :).

The fraction of the original image left without stretching on the left is specified by X The fraction of the original image that gets stretched in the x-axis is specified by Width The fraction of the original image left without stretching on the right is equal to 1 – X – Width If we use 0 for Width the stretched area will interpolate between the last pixel of the left part and the first pixel of the right part The y-axis works analogously

Viewing a .storyboard file in a text editor (figures it's an XML file) revealed the answer: it is linked to UIView's contentStretch property.

Deprecation Documentation

Instance Property

contentStretch

The rectangle that defines the stretchable and nonstretchable regions of a view.

Deprecated

To achieve the same effect, use resizableImageWithCapInsets: instead.

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