Have you Block
classes be the target
for your gesture recogniser:
Block.h
@interface Block : NSObject
@property (nonatomic, strong) UIView *main_view;
@end
Block.m
@implementation Block
-(void)handleMainViewPan:(UIPanGestureRecognizer *)recognizer
{
// Now recognizer.view is the same view as self.main_view
// Use self as this is now your block
}
@end
ViewController.m
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// the Blocks are actually added on runtime to a NSMutableArray, but this is a simpler example
Block *my_block = [[Block alloc] init];
UIPanGestureRecognizer *gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:my_block action:@selector(handleMainViewPan:)];
[my_block.main_view addGestureRecognizer:gestureRecognizer];
[self.view addSubview:my_block.main_view];
}
@end