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 > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-21-2009, 09:03 PM   #1 (permalink)
Ancient Software Engineer
 
Join Date: Jan 2009
Location: Upstate California
Posts: 4
The Grand Poohbah is on a distinguished road
Cool Memory Management - who's right?

The following two examples are from the 20 Jan 2009 Cocoa-dev Digest. The first example is from the iPhone Dev SDK book. The second is a different approach that the author (mmalc) says is better. Who is right? And why?

Message: 13
Date: Tue, 20 Jan 2009 18:50:48 -0800
From: mmalc Crawford <mmalc_lists@me.com>
Subject: Re: Accessing interface elements (iPhone vs Mac)
To: Ashley Perrien <perrien@earthlink.net>
Cc: cocoa-dev@lists.apple.com
Message-ID: <C7B58E0F-CB42-477A-A790-30BF7F462709@me.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jan 20, 2009, at 12:41 PM, Ashley Perrien wrote:

... (Ashley Perrien writes) ...
In iPhone examples many or all of them have:

@interface myViewController : UIViewController
{
*****IBOutlet UILabel *myLabel;
}
@property (retain, nonatomic) UILabel *myLabel;
and then @synthesize myLabel in the implementation. I've even seen *
where the dealloc method will then release the object.

... (mmalc replies)...
This should actually be

@interface MyViewController : UIViewController
{
****UILabel *myLabel;
}
@property (retain, nonatomic) IBOutlet UILabel *myLabel;

The advantage of this approach is that it makes the memory management *
semantics explicit and clear, and it works consistently across all *
platforms for all nib files.

<http://stackoverflow.com/questions/61838>

<Resource Programming Guide: Loading Nib Files Programmatically
The Grand Poohbah is offline   Reply With Quote
Old 01-21-2009, 09:16 PM   #2 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
DevTeamOfOne is on a distinguished road
Default

I was always led to believe there was no difference.
DevTeamOfOne is offline   Reply With Quote
Old 01-21-2009, 10:00 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 145
ambiensignal is on a distinguished road
Default

http://www.iphonedevsdk.com/forum/ip...-iboutlet.html
ambiensignal is offline   Reply With Quote
Old 01-21-2009, 11:04 PM   #4 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 1,431
PhoneyDeveloper is on a distinguished road
Default

Do see my comments on that other thread.

malc works for apple as some kind of evangelist and he posts to cocoa-dev and to the apple iPhone forum. His opinions on this subject are pedantic. I don't agree with all of his opinions . However, all other things being equal it's better to put the IBOutlet token on the property.

This is unfortunately a somewhat misunderstood topic and there are plenty of examples that are incorrect.
PhoneyDeveloper is offline   Reply With Quote
Reply

Bookmarks

Tags
memory management

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 391
10 members and 381 guests
7twenty7, Atatator, FrankWeller, glenn_sayers, guusleijsten, iphonedevshani, MAMN84, QuantumDoja, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,122
Posts: 402,907
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:47 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0