N-Slicing in responsive designs
N-Slicing is useful for artwork that needs to fit a Layout, such as a button background, a speech bubble, or a panel frame. Place an N-Slice directly inside a Layout, and it resizes to fill that Layout while its fixed segments keep their size. See What takes part in a Layout.Creating an N-Slice
You can apply an N-Slice to an image, to a group of vector objects, or to a component instance.On an image
1
Select the image.
2
In the Deform section of the Inspector, click + and select N-Slice. You can also right-click the image on the stage or in the Hierarchy and select Deform > N-Slice.
3
Position the axes and set the tile modes. See Setting up an N-Slice.
4
Click Done in the Inspector or on the stage.
On vector artwork
1
Select the artwork. If it’s already in a group, select the group and click Convert to N-Slice in the Inspector. Otherwise, select the objects and click N-Slice selection in the Inspector, or right-click them and select Wrap in > N-Slice.
2
With the N-Slice group selected, click Edit N-Slice in the Inspector or press Enter.
3
Position the axes. See Setting up an N-Slice.
4
Click Done in the Inspector or on the stage.
On a component instance
A component instance with Mode set to Node can take an N-Slice the same way an image can. The component draws its artboard as a flat image and slices that image, so, like an image, it can look soft when scaled up.1
Select the component instance and set Mode to Node.
2
In the Deform section of the Inspector, click + and select N-Slice.
3
Position the axes and set the tile modes the same way you would for an image.
Setting up an N-Slice
To change an N-Slice, select it and click Edit N-Slice in the Inspector, right-click it and select Edit N-Slice, or press Enter.Set up your N-Slice before resizing the image or group. You can adjust axes on artwork that’s already been resized, but it’s harder to position new ones accurately.
Fixed and scaling segments
Segments alternate between fixed and scaling, starting with a fixed segment. In a 9-slice, that means fixed, then scaling, then fixed, along both the horizontal and vertical axes. In edit mode, fixed segments have solid blue borders, and scaling segments have dashed borders.Positioning axes
A new N-Slice has four axes, two vertical and two horizontal, which divide the artwork into nine segments. Drag an axis to move it, or enter its position in the Inspector in points or as a percentage. To add an axis, drag inward from one of the white handles on the edges of the artwork. A new axis is created with a mirrored partner on the opposite side, which keeps the fixed and scaling segments alternating. To create a single axis instead, hold Cmd (macOS) or Ctrl (Windows) before you start dragging.Setting tile modes
Tile modes control how a scaling segment fills its space. They’re only available on images and component instances.- Stretch: The segment stretches to fill the space.
- Repeat: The segment tiles to fill the space.
- Hidden: The segment isn’t drawn.
1
Open the N-Slice’s edit mode.
2
Click a segment on the stage. Its tile is highlighted in the Inspector.
3
Select a tile mode from the dropdown in the Inspector.