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

View Single Post
Old 12-17-2009, 01:03 PM   #3 (permalink)
benoitr007
Registered Member
 
Join Date: Jun 2009
Posts: 243
benoitr007 is on a distinguished road
Default

Wow, I had no idea. Thanks, that really helped. So I should write:

Code:
NSMutableArray *myArray = [[NSMutableArray alloc] init];
enemiesArray = myArray;
[myArray release];
Is that correct? I'm not sure why you said my first way was okay for an init method. According to your tutorial, won't that mess up the retain count and put it to 2 instead of 1 (doesn't it retain the new value, which is already to 1 because it's been alloc'd)?

EDIT: OK no, wait. Instance variable != instance property. So it IS okay to write enemiesArray = [[NSMutableArray alloc] init], but it's NOT okay to write [self setEnemiesArray:[[NSMutableArray alloc] init]], RIGHT? lol

And for the enemies part:

Code:
enemy *myEnemy = [[enemy alloc] initAtX:-1 y:-1];
[enemiesArray addObject:myEnemy];
[myEnemy release];

Last edited by benoitr007; 12-17-2009 at 01:05 PM.
benoitr007 is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,415
Threads: 94,015
Posts: 402,527
Top Poster: BrianSlick (7,978)
Welcome to our newest member, deannme48
Powered by vBadvanced CMPS v3.1.0

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