Detect Tap on UIImageView within UITableViewCell

前端 未结 6 1536
无人及你
无人及你 2021-02-20 11:40

I have a custom complex UITableViewCell where there are many views. I have an UIImageView within it which is visible for a specific condition. When it\'s visible ,

6条回答
  •  太阳男子
    2021-02-20 12:35

    you can use ALActionBlocks to add gesture to UIImageView and handle action in block

    __weak ALViewController *wSelf = self;
    imageView.userInteractionEnabled = YES;
    UITapGestureRecognizer *gr = [[UITapGestureRecognizer alloc] initWithBlock:^(UITapGestureRecognizer *weakGR) {
        NSLog(@"pan %@", NSStringFromCGPoint([weakGR locationInView:wSelf.view]));
    }];
    [self.imageView addGestureRecognizer:gr];
    

    Install

    pod 'ALActionBlocks'
    

提交回复
热议问题