Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use images sliced with the slicing tool of the XCode5 assets catalog

In the assets catalog in the new XCode5 there's a tool to slice your images, I assume this is used for images that are going to be stretched, and it has the same effect as using the resizableImageWithCapInsets: method on a UIImage object.

My question is, once I sliced my image, how do I use it in my code? I just create the image with the size I want and it's stretched automatically using the insents I set in the slicing tool? Or I have to create it using a special way?

I haven't found any documentation about it yet.

like image 592
Antonio MG Avatar asked Oct 14 '13 09:10

Antonio MG


People also ask

How to use slice tool in Photoshop?

Step 1: Open a sample image in Photoshop as shown below: Step 2: Now select the slice tool from the tool palette. Step 3: Now create a slice of the image from where you want. After drawing the slice, you will see that Photoshop automatically draws other slices to match the whole document.

Can you use the slice tool to cut text?

Although the Slice Tool is a cutting tool mainly used for web design. If you’re thinking about cutting out shapes or creating a sliced text effect, the Slice Tool isn’t what you’re looking for. I mean, technically you can, but there are better tools.

How to select multiple slices in AutoCAD?

There are several aligned options for two or more selected slices. Now, a question may arise that how to select multiple slices? The answer is that we can select multiple layers using the slice select tool using by holding the SHIFT key.

What is the difference between auto slice and user slice?

Now a question may arise how to differentiate whether it is auto slice or user slice? The answer is that auto slices do not have a scaling option enabled within them, but a user slice can be scaled using the slice select tool.


1 Answers

The image slicing in Xcode 5 works with [UIImage imageNamed:@"blah"];. You don't have to do anything in the code. The slicing information is automagically contained in the UIImage that gets returned.

You can set everything using the asset catalog: retina, iPad, slicing, etc...

Then give the whole set of images a name and just use that name.

Your app will then pull out the correct image from the catalog including all the slicing information.

like image 188
Fogmeister Avatar answered Sep 28 '22 10:09

Fogmeister