On Nov 17, 2008, at 8:53 PM, Brian Stern wrote:

Here's my test project:
http://bellsouthpwp2.net/b/r/brians99/projects/TestPropertiesAndOutlets.zip
There are three labels that are outlets. One has a retain property, one an assign property, and the third no property. Unless they are released they are never dealloced. All three act the same.

It would help if you declared/connected your outlets correctly...

If you declare a property:

@property (nonatomic, assign) MyLabel *label1;

but make the connection in IB to mLabel1, then the property accessor isn't used. So the outlet is set using setValue:forKey:. Which results in the value being retained, precisely as described in the documentation...

<http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/chapter_3_section_4.html#//apple_ref/doc/uid/10000051i-CH4-SW6 >

If you declare the the properties as I described:

@interface ViewControllerOne : UIViewController
{
    MyLabel*    mLabel1;
    MyLabel*    mLabel2;
    IBOutlet MyLabel*   mLabel3;
}

@property (nonatomic, assign) IBOutlet MyLabel *mLabel1;
@property (nonatomic, retain) IBOutlet MyLabel *mLabel2;
// No property for label3

then you'll get the behaviour I described...


mmalc

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to