Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6145413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:47:28+00:00 2026-05-23T18:47:28+00:00

The title is hard . The the main case is like this UIView *superView

  • 0

The title is hard .
The the main case is like this

UIView *superView = [[UIView alloc] initWithFrame:CGRectMake(0,0,400,400)];
UIView *subView = [[UIView alloc] initWithFrame:CGRectMake(-200,-200,400,400)];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
[subView addGestureRecognizer:tapGesture];
[superView addSubView:subView];

OK , you will find that the tap gesture will take effect when you click the area in (0,0,200,200) , if you click the point (-150,-150) the tap gesture will not take effect.

I don’t know whether the click outside the superView bounds to cause this problem or not.

Anyone have any idea how to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:47:28+00:00Added an answer on May 23, 2026 at 6:47 pm

    The only workaround I’ve found for case like that is to create an instance of a view that is transparent for touches as main view. In such case inner view will respond to touches as it fits bounds of main. In the class I’ve made from different examples found in the net I can control the level of “touch visibility” like so:
    fully visible – all of the touches end up in the view.
    only subviews – the view itself invisible, but subviews get their touches.
    fully invisible – pretty self explanatory I think 🙂

    I didn’t try to use it with gesture recognizers, but I don’t think there will be any problem, as it works perfectly with regular touches.

    The code is simple…

    TransparentTouchView.h

    #import <UIKit/UIKit.h>
    
    typedef enum{
        TransparencyTypeNone = 0,         //act like usual uiview
        TransparencyTypeContent,          //only content get touches
        TransparencyTypeFull              //fully transparent for touches
    }TransparencyType;
    
    @interface TransparentTouchView : UIView {
        TransparencyType      _transparencyType;
    }
    
    @property(nonatomic,assign)TransparencyType transparencyType;
    
    @end
    

    TransparentTouchView.m

    #import "TransparentTouchView.h"
    
    
    @implementation TransparentTouchView
    
    @synthesize 
    transparencyType = _transparencyType;
    
    - (id)initWithFrame:(CGRect)frame{
        self = [super initWithFrame:frame];
        if (self) {
            // Initialization code
            self.backgroundColor = [UIColor clearColor];
        }
        return self;
    }
    
    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
        // UIView will be "transparent" for touch events if we return NO
        switch (_transparencyType) {
            case TransparencyTypeContent:
                for(UIView* subview in self.subviews){
                    CGPoint p = [subview convertPoint:point fromView:self];
                    if([subview pointInside:p withEvent:event]){
                        return YES;
                    }
                }
                return NO;
                break;
            case TransparencyTypeFull:
                return NO;
            default:
                break;
        }
        return YES;
    }
    
    @end
    

    I believe that you can accomodate it to your needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hard to come up with a proper title for this problem. Anyway... I'm currently
It's hard to put this into the title, so let me explain. I have
Alright, hard to phrase an exact title for this question, but here goes... I
OK, Ruby gurus, this is a hard one to describe in the title, so
My XML comes in like this: <Document type=ContentPage> <Fields> <Field name=FaqCategory type=dropdown title=Select Category:
Sorry if my title is hard to understand. Let me explain. To use this
Hard to think of a title for this one! I have a bean that
The title of this question was hard to come up with, it might not
It's a little bit hard to find an appropriate title for this. I think
I couldn't think of a good title for this, it's hard to explain. Basically,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.