Reputation: 14622
I want to take a picture like this:
And I wrote the code:
[[[UIImage imageNamed:@"background.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(1.f, 1.f, 1.f, 1.f)]
drawInRect:rect];
But with this code I took that:
Why??? How to draw a resized image in rect with fixed 1px on all sides?
Upvotes: 1
Views: 1280
Reputation: 14622
Use the following code to stretch the image on iOS 6+:
[[[UIImage imageNamed:@"background.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(1.f, 1.f, 1.f, 1.f) resizingMode:UIImageResizingModeStretch]drawInRect:rect];
Upvotes: 2