Showing posts with label imageview. Show all posts
Showing posts with label imageview. Show all posts

Stretching an UIImage while preserving the corners




 original image


 result














myImageView.image = [myImageView.image resizableImageWithCapInsets:UIEdgeInsetsMake(20.f, 12.f, 19.f, 19.f)];


For lower iOS version, use 

[UIImage stretchableImageWithLeftCapWidth:15 topCapHeight:13];

add Image Border

iPhone SDK Tips & Tricks

#import <QuartzCore/QuartzCore.h>

[imageView.layer setBorderColor: [[UIColor blackColor] CGColor]];
[imageView.layer setBorderWidth: 2.0];