Created
November 7, 2013 20:27
-
-
Save programmingthomas/7361314 to your computer and use it in GitHub Desktop.
Using nine patch/sliced images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Using with an image view | |
imageView.image = [UIImage imageNamed:@"myimage"]; | |
//Using as the background to another view | |
//Note that you will need to redraw the background when resizing | |
//Therefore if you need to animate resizes it may be more sensible to add a UIImageView | |
//as the background to your view | |
UIImage * myImage = [UIImage imageNamed:@"myimage"]; | |
UIGraphicsBeginImageContextWithOptions(myView.bounds.size, NO, 0); | |
[myImage drawInRect:myView.bounds]; | |
UIImage * backgroundImage = UIGraphicsGetImageFromCurrentContext(); | |
UIGraphicsEndImageContext(); | |
myView.backgroundColor = [UIColor colorWithPatternImage:backgroundImage]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment