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-11-2009, 09:44 AM   #5 (permalink)
zword
Registered Member
 
Join Date: Nov 2008
Posts: 34
zword is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
The +1 you saw was from addSubview. The parent view is retaining its subviews. You do not need to worry about that. If you later remove it from that view, or if it still exists when that view is deallocated, a release message will be automatically sent at that time.

Your responsibility is to balance your memory-related actions - alloc, copy, new, retain - with a release.

It is not your responsibility to guess how Apple's classes work. The implementation for addSubview could retain your slider one time, or it could retain it many times. You have no way of knowing. You have to trust that whatever Apple's classes DO, they will also UNDO appropriately. Same for arrays, dictionaries, etc. The act of adding an object to an array, just like adding your slider to a view, does not involve alloc, copy, or new (unless you do it wrong), so it should not be released.
@BrianSlick: Thanks for the explanation.
zword is offline   Reply With Quote
 

» Advertisements
» Online Users: 872
19 members and 853 guests
13dario13, ADY, Ananth, baja_yu, Batman, cgokey, Christioren, djohnson, gogoman, HenryCLacey, latoncefrank, Lily.P, mer10, mkjarred, mwyld, Nobbsy, Prajakta, Saurman, SillyHoney
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,389
Threads: 94,003
Posts: 402,461
Top Poster: BrianSlick (7,978)
Welcome to our newest member, HenryCLacey
Powered by vBadvanced CMPS v3.1.0

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