Re: Setting color to an NSView
Re: Setting color to an NSView
- Subject: Re: Setting color to an NSView
- From: "I. Savant" <email@hidden>
- Date: Fri, 8 Dec 2006 11:31:03 -0500
In the line in which you create "myRect", you specify a rectangle
that is all the way to the left (0), whose bottom edge starts 398
pixels from the bottom, is 212 pixels wide, and 107 pixels tall.
First, if you want to fill the entire view, I suggest filling the
rect you receive from [self bounds]; ... Second, if the view can be
resized, using static dimensions is a bad idea, no matter if you're
filling the entire bounds or just the rectangle -drawRect: is asking
you to draw. Unless, of course, you *want* to only ever draw a
specific rectangle, rather than filling the whole view.
Hope that helps.
--
I.S.
On Dec 8, 2006, at 9:16 AM, vibhatha v wrote:
Hi,
I have an NSView and this NSView is a part of splitview.
Now, i have to set color to this NSView. Also, i have some text
fields on my
view which should be visible.
i tried setting the color using,
-(void)drawRect:(NSRect)rect
{
NSRect myRect = NSMakeRect(0,398,212,107);
[[NSColor blueColor] set];
NSRectFill(myRect);
}
in my custom class.
Also, i tried setting the view color in my controller class also.
But this does not seem to work.
Can anyone suggest me as to where i have gone wrong?
Thanks and Regards,
Vibhatha.
_______________________________________________
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
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