Hey,
I understand what a weak connection is, but I'm having trouble creating one between a class and its delegate. My set up is as follows:
Class:
Delegate:
To me this should be correct - the only thing I am unsure about is the @property being 'assign' (I know it shouldn't be retain)...
Can anyone spot where I have gone wrong?
Thanks for your time,
-Ross
I understand what a weak connection is, but I'm having trouble creating one between a class and its delegate. My set up is as follows:
Class:
Code:
instance var:
id<ATMyDelegate> *_delegate;
initializer:
-( id ) initWithDelegate:( id * )delegate
{
...
_delegate = delegate;
...
}
usage:
[_delegate myDelegateMethod:self];
properties:
@property( nonatomic, assign ) id *_delegate;
@synthesize _delegate = delegate;
Delegate:
Code:
initialize class:
[class initWithDelegate:self];
dealloc:
[class setDelegate:nil];
[class release];
To me this should be correct - the only thing I am unsure about is the @property being 'assign' (I know it shouldn't be retain)...
Can anyone spot where I have gone wrong?
Thanks for your time,
-Ross