• 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
Re: Crashing View
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Crashing View (From: Tom Marchand <email@hidden>)

  • Prev by Date: Re: about notification exception....
  • Next by Date: Multiple developers and nib files
  • Previous by thread: Re: Crashing View
  • Next by thread: re: Basic Coredata / threading question
  • Index(es):
    • Date
    • Thread