Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4103420
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:57:22+00:00 2026-05-20T20:57:22+00:00

There is a trick Flash Actionscript developers can do to refer to instance properties

  • 0

There is a trick Flash Actionscript developers can do to refer to instance properties at runtime. I was wondering if anything similar existed in Objective-C

In actionscript we can do:

var thisObject;
for (var i=0; i<10; i++) {
   thisObject = this["myInstanceProperty"+i];
   thisObject.doSomething();
}

I thought there would be a method similar to this in Objective-C, but I can’t find anything mentioned anywhere. I’m looking for something along the lines of:

for (int i=0; i<10; i++) {
  NSString *buttonName = [NSString stringWithFormat:@"button_%i", i];
  id *thisButton = [self instancePropertyWithStringName:buttonName];
  thisButton.label = @"button %i";
}

Can you see what I’m getting at? I have a xib linking views to IBOutlets, and I’d like to refer to those IBOutlets from within a for loop, so I can add properties to them dynamically at runtime.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:57:23+00:00Added an answer on May 20, 2026 at 8:57 pm

    You can use the following if the self object conforms to NSKeyValueCoding — which it does by default for its instance variables and properties.

    NSButton *button = [self valueForKey:buttonName];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So in Ruby there is a trick to specify infinity: 1.0/0 => Infinity I
Are there any relatively simple programs for building flash applications. I want to add
I'm having trouble with Camera.getCamera() in Flash AS3. If there are multiple camera drivers,
Are there any tricks for preventing SQL Server from entitizing chars like &, <,
Is there any tricky way to use Java reserved words as variable, method, class,
There are a couple of tricks for getting glass support for .Net forms. I
TFS2008. I'd like to track task points on a Task work item, but there
In your practice, how do you effectively track and manage technical debt? Is there
There is a conversion process that is needed when migrating Visual Studio 2005 web
There are two weird operators in C#: the true operator the false operator If

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.