• 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
NSStringFromClass versus className ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSStringFromClass versus className ?


  • Subject: NSStringFromClass versus className ?
  • From: Dave Jewell <email@hidden>
  • Date: Wed, 20 Feb 2008 15:15:55 +0000

I've seen lots of Cocoa code which uses NSStringFromClass to obtain the name of a particular class, but relatively little code which uses NSObject's built-in className method. Is there a particular reason for this? Is there some hidden 'gotcha inside className waiting to bite me?

I've seen lots of code that looks (e.g.) this:

NSLog (NSStringFromClass ([self class]));

From where I'm sitting, this could be replaced with:

NSLog ([self className]);

Not only is this neater, but it's more "the Cocoa way", in terms of not calling a procedure.

Dave

_______________________________________________

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: NSStringFromClass versus className ?
      • From: glenn andreas <email@hidden>
  • Prev by Date: Re: How to draw a CGImage object to a NSView?
  • Next by Date: Problems with CAConstraint
  • Previous by thread: Re: setWantsLayer: YES causing font render problem?
  • Next by thread: Re: NSStringFromClass versus className ?
  • Index(es):
    • Date
    • Thread