views:

140

answers:

1

I am not sure about it. Would I do that this way?

@property(nonatomic) MyParentObject *parentObject;

Note that I just left out the retain Keyword. Or would I have to write the Setter by myself?

+7  A: 

Instead of retain, you can use the assign attribute (which is actually the default). assign will prevent your generated setter from retaining or releasing parentObject. For example:

@property (assign, nonatomic) MyParentObject *parentObject;

For a list of all attributes that can be used by Objective-C properties, take a look at the documentation.

Sebastian Celis