custom delegate in objective c -


i've done class this:

testclass <uiaccelerometerdelegate> 

and implement methods of delegate.

then in other class want delegate i've done:

testclass *t = [[testclass alloc]init]; uiaccelerometer *a = [uiaccelerometer sharedaccelerometer]; [a setdelegate: t]; 

and in dealloc release t.

it works, right way write general delegate?

in general right, need careful when deciding retain or assign delegate avoid circular references. have been bit before. here post talking , nuances aware of: why objective-c delegates given property assign instead of retain?


Comments