Drag an Image within the Bounds of Superview

This post demonstrates how to drag an image on screen, respecting the bounds of the images superview.

The first step is to create a class that inherits from UIImageView, I’ll name the class ImageToDrag. There is only one instance variable in this class, currentPoint – a CGPoint structure which has an X and Y coordinate indicating where the touch began prior to dragging.

Here is the interface definition for ImageToDrag:
Continue reading

How to Mask an Image

Masking an image enables a developer to create images with irregular shapes dynamically. Masking is often used to create a user interface that is more compelling and less boring.

Take for example the following example …

maskingstoryboard.png

Continue reading