Forked from mjjimenez/UIView+StringTagAdditions.h
Last active
August 29, 2015 14:23
-
-
Save thomaswhyyou/29664091b7b6d649f8fc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#import <UIKit/UIKit.h> | |
@interface UIView (StringTagAdditions) | |
@property (nonatomic, copy) NSString *stringTag; | |
@end |
This file contains hidden or 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
#import "UIView+StringTagAdditions.h" | |
#import <objc/runtime.h> | |
@implementation UIView (StringTagAdditions) | |
static NSString *kStringTagKey = @"StringTagKey"; | |
- (NSString *)stringTag | |
{ | |
return (NSString*) objc_getAssociatedObject(self, CFBridgingRetain(kStringTagKey)); | |
} | |
- (void)setStringTag:(NSString *)stringTag | |
{ | |
objc_setAssociatedObject(self, CFBridgingRetain(kStringTagKey), stringTag, OBJC_ASSOCIATION_COPY_NONATOMIC); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment