Re: Setting color to an NSView
Re: Setting color to an NSView
- Subject: Re: Setting color to an NSView
- From: "Alan Smith" <email@hidden>
- Date: Fri, 8 Dec 2006 10:09:16 -0500
I'd do it like this:
- (void)drawRect:(NSRect)rect
{
rect = [self bounds];
[[NSColor blueColor] set];
[self lockFocus];
[NSBezierPath fillRect: rect];
[self unlockFocus];
}
Perhaps that will fix it? In your code myRect should not be
hard-coded. It's better to use something like bounds to get the rect
you want. Or if you only want to fill a portion of the view use some
math to keep it dynamic.
Hope this helps.
Peace, Alan
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unnecessary, then it
shall evolve."
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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