Ios image stretching: ios image stretching
Ios image stretching Methods
UIImage * image = [UIImage imageNamed: @ "qq"];
First:
// Width of the Left End Cover NSInteger leftCapWidth = image. size. width * 0.5f; // the height of the top cover NSInteger topCapHeight = image. size. height * 0.5f; // re-assign image = [image stretchableImageWithLeftCapWidth: leftCapWidth topCapHeight: topCapHeight];
Second:
CGFloat top = 25; // top cover height CGFloat bottom = 25; // bottom end cover height CGFloat left = 10; // left End Cover width CGFloat right = 10; // width of the right end cover UIEdgeInsets insets = UIEdgeInsetsMake (top, left, bottom, right); // specify the stretch mode and assign the image = [image resizableImageWithCapInsets: insets resizingMode: UIImageResizingModeStretch];
Supplement: UIButton:
[Button setBackgroundImage: image forState: UIControlStateNormal];
Source image:
Tags: fragmentation