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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

Thread: Random Rocks
View Single Post
Old 01-06-2010, 11:37 PM   #30 (permalink)
smasher
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
Default

Right - if you remove the rock and no one is retaining it, it'll get dealloc'ed. Calling a method on a destroyed object will usually give you an EXC_BAD_ACCESS. That's why I said you might want to move it to the top instead.

If you still want to remove it, do this:

Code:
[myRock removeFromSuperview];
myRock=nil;
Now myRock points to nil, and you can call any methods you want - it'll have no effect and will always return zero. Or can check if (myRock==nil) to see if the rock exists or not before taking an action.
__________________

Free Games!
smasher is offline   Reply With Quote
 

» Advertisements
» Online Users: 304
18 members and 286 guests
ADY, antonwilliams, dacapo, dcool, HemiMG, iosdevjtp, jakerocheleau, leahov, MarkC, masc2279, michelle, morands, MozyMac, nobre84, sly24, smithdale87, thh022, vogueestylee
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,877
Threads: 89,222
Posts: 380,720
Top Poster: BrianSlick (7,129)
Welcome to our newest member, peterkessler45
Powered by vBadvanced CMPS v3.1.0

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