Created
August 9, 2012 16:06
-
-
Save krzysztofzablocki/3305468 to your computer and use it in GitHub Desktop.
UITableViewCell + representedObject
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
// Created by Krzysztof Zabłocki | |
@interface UITableViewCell (representedObject) | |
@property (nonatomic, strong) id representedObject; | |
@end | |
#import "UITableViewCell+representedObject.h" | |
#import <objc/runtime.h> | |
static char RepresentedObjectKey; | |
@implementation UITableViewCell (representedObject) | |
- (id)representedObject | |
{ | |
return objc_getAssociatedObject(self, &RepresentedObjectKey); | |
} | |
- (void)setRepresentedObject:(id)representedObject | |
{ | |
objc_setAssociatedObject(self, &RepresentedObjectKey, representedObject, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment