これはStackOverflowに関する私の最初の質問なので、十分に明確になっていることを願っています。
iPhone用のゲームをデザインしていますが、一部のオブジェクトの表示に問題があります。オブジェクトのNSMutableArray(UIImageViewをサブクラス化するカスタムオブジェクトクラス)があり、それらすべてを画面に表示できるようにしたいと考えています。ただし、配列はサイズを変更できるため、InterfaceBuilderで各要素を直接リンクすることはできません。誰かが私がこの問題を解決し始める方法について何か考えがありますか?
ありがとう!
コード:
//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)];
}
}