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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:42:48+00:00 2026-06-07T00:42:48+00:00

This is my first question on Stack Overflow, so I hope that I’m clear

  • 0

This is my first question on Stack Overflow, so I hope that I’m clear enough.

I am designing a game for the iPhone, and am having trouble displaying some objects. I have an NSMutableArray of objects (a custom object class that subclasses UIImageView), and I want to be able to display them all on the screen. However, the array can change size, so I can’t directly link each element in interface builder. Does anyone have any idea on how I can start solving this issue?

Thanks!

The Code:

//This code is in the viewController.m file
//The main array of objects is nodeList. Each node subclasses UIImageView.
//nodeList was also synthesized at the beginning of the file with @synthesize.


//initialize array
nodeList= [[NSMutableArray alloc] initWithCapacity:(vertLinks*horizLinks)];

//make center node
Node *n = [Node alloc];

//Initialize the node (just puts an x and y position in, and gives it a mass)
[n nodeInit:(startX):(startY):(nodeMass)];
[nodeList addObject:(n)];

//creates a 'web' of nodes, and adds each one to the array
for (int i = 1; i < vertLinks; i++)
{
    for (int j = 0; j < horizLinks; j++)
    {
        //draw the line to each point
        int nodeX = (startX + cos(((360 / horizLinks) * j) * (M_PI / 180)) * rad * i);
        int nodeY = (startY + sin(((360 / horizLinks) * j) * (M_PI / 180)) * rad * i);

        //add it to the screen
        Node *nd = [Node alloc];

        [nd nodeInit:(nodeX):(nodeY):(nodeMass)];

        if (i == vertLinks - 1)
        {
            nd.solid = true;
        }

        [nodeList addObject:(nd)];
    }
}
  • 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-07T00:42:49+00:00Added an answer on June 7, 2026 at 12:42 am

    Kinda hard to answer precisely but essentially you’ll need to loop through the objects in the array, and add each one separately. If these objects are views like UIView, UIImageView or UIButton, then you can just do this:

    for (int i=0; i<array.count; i++) {
       UIView *thisView = [array objectAtIndex:i];
       [self.view addSubview:thisView]
    }
    

    If they are strings or numbers or something then you’ll need to create a label or a text field or something to display the objects.

    for (int i=0; i<array.count; i++) {
       NSString *string = [array objectAtIndex:i];
       UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100*i, 100, 100)];
       [label setTitle:string];
       [self.view addSubview:label]
    }
    

    It really matters what object type you’re talking about. You need to tell us what kind of images these are if you need any real help. It’s also just the proper way to post.

    Please post more details and I’ll be happy to continue my answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my first question on stack overflow, I hope you can help me.
This is my first question on Stack Overflow, and I hope it's pretty simple.
( Preface: This is my first audio-related question on Stack Overflow, so I'll try
First off - hello, this is my first Stack Overflow question so I'll try
this is my first question on stack overflow, so be gentle. Let me first
Hey there guys, this is my first question on Stack Overflow. I figured this
This is my first question here on stack overflow. i need help on a
this is my first question on stack overflow but I have some experience in
This is my first question here on stackoverflow, so I hope that I am
this is my first question here at Stack Overflow. I've been looking for a

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.