• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[NEWB] Filling a rect with an Image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[NEWB] Filling a rect with an Image


  • Subject: [NEWB] Filling a rect with an Image
  • From: Brad Gibbs <email@hidden>
  • Date: Wed, 06 Aug 2008 08:50:12 -0700

I'm trying to create a view with a background image, but getting error after error...

- (void)drawRect:(NSRect)rect {
    NSRect bounds = [self bounds];
	NSImage *background = [[NSImage alloc] init];
	[background setImage:@"ScrollBackground"];
	[[NSColor colorWithPatternImage:background] set];
	[NSBezierPath fillRect:bounds];
}


I've added a .png named ScrollBackground to my Resources folder. The code compiles but I get a warning: "NSImage may not respond to '- setImage'.


How can I make this right?

Thanks.

Brad
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [NEWB] Filling a rect with an Image
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: Re: CGGStackRestore: gstack underflow
  • Next by Date: Re: [NEWB] Filling a rect with an Image
  • Previous by thread: Re: remove elements during the iteration on NSMutableDictionary
  • Next by thread: Re: [NEWB] Filling a rect with an Image
  • Index(es):
    • Date
    • Thread