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 9016215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:56:17+00:00 2026-06-16T03:56:17+00:00

How do I create multiple instances of an identical object and call them in

  • 0

How do I create multiple instances of an identical object and call them in an array in an efficient manner?
I am aware of for-loops, but am not familiar with Objective-C syntax. This is what I currently have:

ViewController.h

NSArray *wArray;
NSInteger w0, w1, w2, w3, w4, w5, w6, w7 , w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28;

@property NSArray *wArray;
@property NSInteger w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28;
@end

ViewController.m

@synthesize w0, w1, w2, w3, w4, w5, w6, w7 , w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28, wArray;

wArray = [NSArray arrayWithObjects: w0, w1, w2, w3, w4, w5, w6, w7 , w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28, nil];

Thanks in advance!

  • 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-06-16T03:56:18+00:00Added an answer on June 16, 2026 at 3:56 am

    Create a NSMutableArray and use:

        for(int i = 0; i < 20; i++) {
            [array addObject:someObject];
        }
    

    And if you want to store integers you can use:

    NSNumber *someObject = [NSNumber numberWithInteger:1];
    

    You can then access these objects by:

    [array objectAtIndex:1];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to create multiple instances of an object in javascript such that
Consider the code below. I do not want to create multiple instances of class
I want to create multiple instances of a class without saving them to a
Is it possible to create multiple instances of ID3DXRenderToSurface and have them rendering in
I have a noob-question, that might be similar to Dynamically create multiple instances of
Suppose I create a Windows Azure application that consists of multiple instances talking to
I want to create multiple instances of Zend_Auth class as I have two modules
I was wondering is it possible to create multiple instances of a single Activity
is it more efficient to run multiple instances of a ruby script ? or
I'm trying to create multiple instances of the simple modal popup on a single

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.