P. 1
The Objective-C Programming Language - Book

The Objective-C Programming Language - Book

3.0

|Views: 689|Likes:
Published by Nikunj Soni

More info:

Published by: Nikunj Soni on Dec 01, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF or read online from Scribd
See more
See less

06/26/2013

To break an association, you typically useobjc_setAssociatedObject, passingnil as the value.

Continuing the example shown in Listing 7-1 (page 83), you could break the association between the array
and the stringoverview using the following line of code:

objc_setAssociatedObject(array, &overviewKey, nil, OBJC_ASSOCIATION_ASSIGN);

(Given that the associated object is being set tonil, the policy isn’t actually important.)

Tobreakallassociationsforanobject,youcanuseobjc_removeAssociatedObjects.Ingeneral,however,
you are discouraged from using this since this breaks all associations for all clients. You only use this function
if you need to restore an object to “pristine condition.”

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->