Stretching an image
Sometimes, it's necessary to have more than one sample of a picture in order to see which ratio is the desired one. Let's imagine that we have a message, but we don't want to show it to the user; we only want to show something that gives him an idea that there is something and the application will show the correct ratio later.
For cases like these, you can use UIImage
and ImageView
, and visualize it on the playground.
Getting ready
Create a new playground called Chapter 6 Stretching Image
and also have an image ready for this recipe. I would recommend that you download the image file secret_message.png
that is included with the resource files of this book.
How to do it...
To create a playground that stretches an image, follow these steps:
Close the Xcode and open a Finder window, go to the folder where you saved the playground, click on the project that you created, and right-click (or control-click) on it. On the menu, choose the option Show Package Contents, as we learned...