• 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: Using NSClassFromString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSClassFromString


  • Subject: Re: Using NSClassFromString
  • From: Chris Hanson <email@hidden>
  • Date: Fri, 26 Dec 2003 11:10:11 -0600

On Dec 26, 2003, at 6:58 AM, Ramakrishna Kondapalli wrote:
I have created id aNamesClass by using NSClassFromString(@"myClass").
myClass has a static/class variable and I want to access that through
aNamesClass. Does anybody know how to do this?

Objective-C doesn't have true class variables. You'll need to use accessor methods in the class to manipulate the value of your global variable.

Furthermore, your code should read

Class myClass = NSClassFromString(@"myClass");

since the result from NSClassFromString is a Class, not an id.

-- Chris

--
Chris Hanson <email@hidden>
bDistributed.com, Inc.
Outsourcing Vendor Evaluation
Custom Mac OS X Development
Cocoa Developer Training
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Using instance of Protocols across application layer files
  • Next by Date: Adding Images to nib files in IB?
  • Previous by thread: Re: Using instance of Protocols across application layer files
  • Next by thread: Re: Using NSClassFromString
  • Index(es):
    • Date
    • Thread