Tuesday, April 23, 2013

UIImage UIImageResizingModeTile example ios

UIImageResizingMode - UIImageResizingModeTile

Specifies the possible resizing modes for an image.
typedef enum {
   UIImageResizingModeTile,
   UIImageResizingModeStretch,
} UIImageResizingMode;
Constants
UIImageResizingModeTile
The image is tiled when it is resized. In other words, the interior region of the original image will be repeated to fill in the interior region of the newly resized image.
Available in iOS 6.0 and later.
Declared in UIImage.h.
UIImageResizingModeStretch
The image is stretched when it is resized. In other words, the interior region of the original image will be scaled to fill in the interior region of the newly resized imaged.
Available in iOS 6.0 and later.
Declared in UIImage.h.
Example of UIImageResizingModeTile


UIImage* cappedCloud = [[UIImage imageNamed: @"cloud.png"] resizableImageWithCapInsets: UIEdgeInsetsMake(9, 9, 9, 9) resizingMode: UIImageResizingModeTile];

[cloudButton setBackgroundImage:cappedCloud forState:UIControlStateNormal];
[cloudButton setAlpha: 0.85f];

cloudImage.image = cappedCloud;

Example of UIImageResizingModeTile