Skip to content

Instantly share code, notes, and snippets.

@cbess
Created October 3, 2011 15:11
Show Gist options
  • Save cbess/1259332 to your computer and use it in GitHub Desktop.
Save cbess/1259332 to your computer and use it in GitHub Desktop.
Set UIView background image (the better way)
// Sets the view's background to the given image
static void SetBackgroundImage(UIView *view, NSString *imageName)
{
view.layer.contents = (id)[UIImage imageNamed:imageName].CGImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment