Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

Thread: Random Rocks
View Single Post
Old 03-07-2010, 11:02 AM   #67 (permalink)
smasher
Registered Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
smasher will become famous soon enough
Default

Quote:
Originally Posted by Exaviorn View Post
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.
__________________

Free Games!
smasher is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,535
Threads: 94,052
Posts: 402,640
Top Poster: BrianSlick (7,979)
Welcome to our newest member, Chayolei001
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:58 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.