Quote:
Originally Posted by Exaviorn
Could you give me a few pointers on how I would that up, and use it on a large number scale and randomness that I could use with the Random Rock example?
|
For info on creating your own class, see the sections on "Designing a Class Interface" and "Class Implementation" on this page:
Cocoa Dev Central: Learn Objective-C
Whatever book you're using to learn objective-C must have a chapter on that too.
Once you have your own Rock class with a "view" property and whatever variables and properties you need, you can init that class:
Code:
//
newRock= [[Rock alloc] init];
rock.view.center = //whatever
[self.view addSubview: rock.view]; //adds meteors as subviews
[meteorArray addObject: rock.view]; //add to array
The init method for the Rock class can init the UIImageView, set up your other variables, choose a random position, and whatever other setup you need.