Created
August 22, 2013 23:35
-
-
Save inailuy/6314027 to your computer and use it in GitHub Desktop.
Attaching a Variables to a object at run time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id obj; | |
// Creating a variable at run time | |
objc_setAssociatedObject(obj,@"variable", variable, OBJC_ASSOCIATION_RETAIN); | |
// Accessing the variable later | |
objc_getAssociatedObject(obj,@"variable"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment