123456789101112131415161718192021222324252627282930313233343536373839404142 |
- //
- // XYWebOnRedirectRequestURLProtocol.m
- // Starbuds
- //
- // Created by 翟玉磊 on 2020/5/30.
- // Copyright © 2020 翟玉磊. All rights reserved.
- //
- #import "IanClickImageView.h"
- @implementation IanClickImageView
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- // Initialization code
- self.userInteractionEnabled=YES;
- }
- return self;
- }
- -(void)addTarget:(id)target action:(SEL)action
- {
- self.target = target;
- self.action = action;
- }
- -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- {
- //如果self.target表示的对象中, self.action表示的方法存在的话
- if([self.target respondsToSelector:self.action])
- {
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
- [self.target performSelector:self.action withObject:self];
- #pragma clang diagnostic pop
- }
- }
- @end
|