Skip to content

Instantly share code, notes, and snippets.

@cbess
Created November 25, 2011 08:36
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbess/1393058 to your computer and use it in GitHub Desktop.
Save cbess/1393058 to your computer and use it in GitHub Desktop.
Set NSView layer background image
// Sets the view's background to the given image
// prior to call, you may need to execute: `view.wantsLayer = YES`
void SetBackgroundImage(NSView *view, NSString *imageName)
{
view.layer.contents = (id)[NSImage imageNamed:imageName];
}
@czwen
Copy link

czwen commented May 17, 2013

thank you so much

@czwen
Copy link

czwen commented May 17, 2013

thank you so much

@czwen
Copy link

czwen commented May 17, 2013

thank you so much

@czwen
Copy link

czwen commented May 17, 2013

thank you so much

@czwen
Copy link

czwen commented May 17, 2013

thank you so much

@Cy-Yasin
Copy link

Cy-Yasin commented Jan 4, 2017

it works perfect, thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment