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

  • Home
  • SEARCH
  • 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 6546703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:44:25+00:00 2026-05-25T11:44:25+00:00

I want to pass an NSString to a method and have that particular NSString

  • 0

I want to pass an NSString to a method and have that particular NSString name a new NSSMutableArray. Confusing? Programmatically looks like this:

+ (void)newMutableArrayWithName:(NSString*)theArrayName
{
     NSLog(@"Creating an array that is named: %@",theArrayName);
     NSMutableArray* theArrayName = [[NSMutableArray alloc] init];
}

Unfortunately, “theArrayName” is not affiliated with the argument passed to the method. Is there any way this is achievable?

  • 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-25T11:44:26+00:00Added an answer on May 25, 2026 at 11:44 am

    The name of a variable is used by the compiler, and is set at compile-time, not at run time.

    If you need to be able to associate a label with an array, I suggest that you use an NSDictionary to do something like this

    NSString *theArrayName = @"My Cool Array";
    NSMutableArray *theArray = [NSMutableArray array];
    NSDictionary *theDictionary = [NSDictionary dictionaryWithObjectsAndKeys: 
                                          theArray, theArrayName, nil];
    

    You could have multiple “named” arrays in the dictionary, if you wanted, and could access them by the names that you gave them

    [theDictionary objectForKey:@"My Cool Array"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently parsing some xml that looks like this <Rows> <Row MANUFACTURERID=76 MANUFACTURERNAME=Fondont
I have this method: - (void)postDictionary:(NSDictionary *)dictionary toURL:(NSURL *)url forDelegate:(id)delegate withIdentifier:(NSString *)identifier; I want
I want to know that how can I pass UIColor's name to the specific
I have a callback method that I got to work, but I want to
I want to pass a variable to a UIButton action, for example NSString *string=@one;
I want to pass an integer value to a form in .Net so that
I want to pass some parameters to my MVC UserControl like ShowTitle(bool) and the
I want to pass a byte[] to a method takes a IntPtr Parameter in
I want to pass a variable to he buttonEvent method in the selector. [button
I have a uitableview that is populated from a sqlite query. I want to

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.