Please help me, I have been customizing a UIView class to set NSString value as a tag, but how can I get that view from view hierarchy.In UIView class default method to get view is viewWithTag:(NSInteger)
.
Please see below code
#import <UIKit/UIKit.h>
@interface UIView (StringTag)
@property (nonatomic, copy) NSString *tagString;
@end
#import "UIView+StringTag.h"
#import <objc/runtime.h>
static const void *tagKey = &tagKey;
@implementation UIView (StringTag)
- (void)setTagString:(NSString *)tagString
{
objc_setAssociatedObject(self, tagKey, tagString,OBJC_ASSOCIATION_COPY_NONATOMIC);
}
- (id)tagString
{
return objc_getAssociatedObject(self, tagKey);
}
@end
I want a method like viewWithStringTag:(NSString *)stringTag
.
Thanks,