#import <UIKit/UIKit.h>
@protocol EJUITableViewCellDelegate <NSObject>
-(void)didClickedCell:(id)object cellAtIndexPath:(NSIndexPath *)indexPath;
@end
@interface UITableViewCell (Helper)
@property(assign, nonatomic) id <EJUITableViewCellDelegate> currentDelegate;
@property (strong, nonatomic) NSIndexPath *currentIndexPath;
- (void)configCellWithDictionary:(NSDictionary *)dictionary cellAtIndexPath:(NSIndexPath *)indexPath;
- (void)configCellWithNSArray:(NSArray *)array cellAtIndexPath:(NSIndexPath *)indexPath;
@end
#import "UITableViewCell+Helper.h"
#import <objc/runtime.h>
@implementation UITableViewCell (Helper)
- (void)configCellWithDictionary:(NSDictionary *)dictionary cellAtIndexPath:(NSIndexPath *)indexPath
{
}
- (void)configCellWithNSArray:(NSArray *)array cellAtIndexPath:(NSIndexPath *)indexPath
{
}
-(void)setCurrentDelegate:(id<EJUITableViewCellDelegate>)currentDelegate
{
objc_setAssociatedObject(self, @selector(currentDelegate), currentDelegate, OBJC_ASSOCIATION_ASSIGN);
}
-(id<EJUITableViewCellDelegate>)currentDelegate
{
return objc_getAssociatedObject(self, @selector(currentDelegate));
}
-(void)setCurrentIndexPath:(NSIndexPath *)currentIndexPath
{
objc_setAssociatedObject(self, @selector(currentIndexPath), currentIndexPath, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
-(NSIndexPath*)currentIndexPath
{
return objc_getAssociatedObject(self, @selector(currentIndexPath));
}
@end