• 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
Send msg to object by nameed NSString;
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Send msg to object by nameed NSString;


  • Subject: Send msg to object by nameed NSString;
  • From: Trygve Inda <email@hidden>
  • Date: Wed, 18 Jun 2014 11:23:58 -0700
  • Thread-topic: Send msg to object by nameed NSString;

If I have a class:

@interface MyClass : NSObject
{
    NSNumber*    myNumber;
}
@property (nonatomic, retain) NSNumber* myNumber;


And in the class implementation I have:

-(void)doSomething
{
    // it could get this string from anywhere, not always a constant
    NSString* myString = @"myNumber";

     ???
}


Is there a way to access the myNumber property and send it a message knowing
only it's name (contained in myString)?

So rather than doing:

[myNumber release];

I could do something like:

[getProperty(myString) release];


Thanks,

Trygve



_______________________________________________

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: Send msg to object by nameed NSString;
      • From: Daniel DeCovnick <email@hidden>
    • Re: Send msg to object by nameed NSString;
      • From: Jens Alfke <email@hidden>
  • Prev by Date: iOS app restarting from screen one. Why?
  • Next by Date: Re: Bindings setup with NSCollectionViews
  • Previous by thread: RE: iOS app restarting from screen one. Why?
  • Next by thread: Re: Send msg to object by nameed NSString;
  • Index(es):
    • Date
    • Thread