Re: Crashing View
Re: Crashing View
- Subject: Re: Crashing View
- From: Chris Hanson <email@hidden>
- Date: Sat, 7 Apr 2007 21:56:01 -0700
On Apr 7, 2007, at 3:00 PM, Tom Marchand wrote:
- (id)initWithFrame:(NSRect)frameRect
{
if ((self = [super initWithFrame:frameRect]) != nil)
{
BackGround=[NSColor colorWithDeviceRed:.50 green:0.50 blue:.50
alpha:.50];
//BackGround=[NSColor grayColor];
}
return self;
}
In addition to what others have pointed out (that +[NSColor
colorWithDeviceRed:green:blue:alpha:] returns an autoreleased
NSColor), it's also important to follow the framework's naming
conventions. Your instance variable should be named "background"
rather than "BackGround" because (a) instance variable names start
with a lower-case letter, while class and type names start with an
upper-case letter, and (b) "background" is one word in English, not
two, so it doesn't need internal capitals.
In general, following the Cocoa naming and coding conventions will
make your code easier for anyone else to read, understand, and
maintain -- and "anyone else" includes "you in a few months" of
course. :)
-- Chris
_______________________________________________
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