Search code examples
xcodeimageslicestretchstretching

Meaning of the middle line on xcode asset slicing?


Official documentaion:

https://help.apple.com/xcode/mac/8.0/#/deve65bd8d0d

3 vertical lines: - left line shows the left unstretchable area - right line shows the right unstretchable area But can't understand what does the middle vertical line actually do. Could you explain how does it work?


Solution

  • But can't understand what does the middle vertical line actually do. Could you explain how does it work?

    The middle line controls the width of the resizable part of the image. When you're done with vertical slicing, you end up with three parts: the left part, the right part, and a center part that will be stretched (or tiled) to let the image fill whatever space you need. The center part is the area between the left and middle lines. Notice that the area between the middle and right lines is shaded, indicating that that part of your original image will be removed from the sliced asset.

    Note that you can also slice horizontally or horizontally and vertically. If you slice in both directions, you end up with what's known as a nine patch image, where there are unstretchable parts for the four corners, horizontally stretchable parts for the top and bottom edges, vertically stretchable parts for the left and right edges, and a vertically and horizontally stretchable center section.