Attributes Inspector: how to use "Stretching"
Asked Answered
S

4

16

What are the numbers in the Stretching box in the View sub-box Interface Builder's Attributes Inspector?

(as a side question - I suppose a respectable company such as Apple would have actually released documentation for its tools, as opposed to letting developers just guess everything; so, where's this documentation?...)

Samaritan answered 16/6, 2012 at 12:48 Comment(0)
S
2

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.

Samaritan answered 16/8, 2012 at 23:27 Comment(0)
K
4

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

Kilby answered 12/3, 2015 at 0:54 Comment(0)
S
2

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.

Samaritan answered 16/8, 2012 at 23:27 Comment(0)
R
0

FYI - this was deprecated in iOS 6.0 https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/index.html#//apple_ref/occ/instp/UIView/contentStretch

(updated link)

Raddle answered 16/9, 2014 at 1:23 Comment(2)
"Sorry, that page cannot be found."Zildjian
Just in case someone else gets here(like me), and wants an updated link to the docs stating the deprecation.Sailor
P
0

Deprecation Documentation

enter image description here

Instance Property

contentStretch

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

Deprecated

To achieve the same effect, use resizableImageWithCapInsets: instead.

Pekingese answered 11/12, 2016 at 21:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.