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

View Single Post
Old 06-04-2009, 01:28 PM   #1 (permalink)
MatuX
Registered Member
 
Join Date: May 2009
Posts: 87
Default To autorelease or not to autorelease

I was reading a code example from a book when I found this:

Code:
	
[self.navigationItem setRightBarButtonItem:[[[UIBarButtonItem alloc]
	initWithTitle:@"Randomize"
	style:UIBarButtonItemStylePlain
	target:self
	action:@selector(randomizePositions)] autorelease]];
If I do a refcount or retainCount for self.navigationItem.rightBarButtonItem it shows that it has 3 references!
Why? Should I care?
Why do I have to write autorelease there?
What if I don't?
When do I know I should call autorelease?

Best regards,
Matias

Last edited by MatuX; 06-04-2009 at 01:34 PM.
MatuX is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,716
Threads: 89,177
Posts: 380,480
Top Poster: BrianSlick (7,118)
Welcome to our newest member, Lfelipe
Powered by vBadvanced CMPS v3.1.0

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