Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gizzerd91

macrumors newbie
Original poster
I've been out of internet contact for the last week and am returning with a whole slew of questions about arrays. I'll list them all and if you have a way to accomplish any of these, or if there's some documentation that I haven't found yet that I could read and it would answer all my questions, I'd love your help. Here goes:

- How do I add and subtract objects from an array without manually reconstructing an array? (equivalent of pop and push functions in other languages)
- Can you pass arrays as variables in a message (ex: [anObject doSomethingWithArray:array])
- Can you have 2 dimensional arrays, or arrays containing other arrays?

And then another question on an unrelated note:

I want to have a basic class that keeps track of a sprite, that I can instantiate over an over again, which I can keep copies of in an array and use to keep track of all of the sprites moving on my iPod. How should I reference the class file (SpriteInfo.m or SpriteInfo.h) and where should I put it in EAGLView so that I can declare variables of the type SpriteInfo?
 
1 - addObjectAtIndex /*removeOnjectAtIndex methods
2 - You pass it a pointer to the array
3 - Yes

4 - You always call the .h file. You declare objects of type SpriteInfo... unless I'm misunderstanding your question. You can do it like this: SpriteInfo *instanceName = [[SpriteInfo init] alloc];

I suggest that you get Programming in Objective-c 2.0 by Stephan Kochan. I knew lots of languages before comming to Objective-C and it really saved me lots of time getting up and running in making iPhone games.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.