Note: This other question seems relevant but it's not: When does an associated object get released?
I'm adding a second description to a UIView
instance as follows:
- (void) setSecondDescription:(UIView*)view description2:(NSString*)description2 {
objc_setAssociatedObject (view,&key,description2,OBJC_ASSOCIATION_RETAIN);
}
- (NSString*) secondDescription:(UIView*)view {
return (id)objc_getAssociatedObject(view, &key);
}
If the UIView
deallocs, will the associated description 2 get dealloced? Is there any way to get this to happen automatically?