display objects on iPhone screen via code
<p>This is my first question on Stack Overflow, so I hope that I'm clear enough.</p>

<p>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?</p>

<p>Thanks!</p>

<p>The Code:</p>

<pre><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 &lt; vertLinks; i++)
{
    for (int j = 0; j &lt; 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)];
    }
}
</code></pre>
