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 7932939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:10:16+00:00 2026-06-03T21:10:16+00:00

I have several UIViews that have somewhat complex shapes that I have drawn via

  • 0

I have several UIViews that have somewhat complex shapes that I have drawn via each UIView’s drawRect: method. I have saved a reference to the path (via a CGPath property) and I am using that in my touches methods to detect whether or not the touch is actually within the path or shape (CGPathContainsPoint). Because of the shapes, there are areas of the view that are transparent (obviously anything that is not square/rectangular will have areas of transparency, assuming the view’s backgroundColor property is set to clearColor or some such).

For situations (which occur often) where the view’s end up on top or overlapping one another, I am testing in the touches methods (touchesBegan etc) to see if the touch is actually within the CGPath or shape. If the touch is not within the shape, I am forwarding the touch to the next view underneath to see if it in turn passes that requirement.

Sadly though (and much to my dismay), this does not behave the same as a touch actually being bound to the view. I have worked around this issue in every way except for one in particular. Each view is using a UIRotationGestureRecognizer. But if a touch originates in another view’s transparent area, and that view forwards that touch to a view underneath it, the UIGestureRecognizer is never triggered.

I have looked at this from every angle I know how to. I have tried to think of some way of actually reassigning or binding the touch to the appropriate view, but I don’t know if this is even possible. So long as the views are just forwarding the touch to another view, the touch will remain bound to the original view that received the touch first.

I wonder if you can do something this way by subclassing UIApplication or UIWindow and override the sendEvent:” method. I’m not sure exactly what control Apple might give you in this. I can’t afford to do anything that might be accessing private API’s. I really just need some way to reassign the touch so that the view thinks the touch belongs to it.

Any ideas?’

  • 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-06-03T21:10:18+00:00Added an answer on June 3, 2026 at 9:10 pm

    You could do this by either subclassing UIView or subclassing UIGestureRecognizer.

    Subclassing UIView

    By subclassing UIView (or any of its subclasses) and overriding

    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
    

    you can decide what points are considered to be inside your view. For points outside the path you simply return NO

    Subclassing UIGestureRecognizer

    By subclassing UIGestureRecognizer (or any of its subclasses) and overriding

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    

    you can decide what touches the gesture recognizer should recognize. For all touches outside the path you should call (but not subclass)

    - (void)ignoreTouch:(UITouch *)touch forEvent:(UIEvent *)event
    

    on yourself.


    Point inside of path?

    In either case you need to know if the points is inside of the path that you say you’ve stored.

    If the paths are already stored as UIBezierPaths you can simply call

    - (BOOL)containsPoint:(CGPoint)point
    

    On the bezier path. The point or the touch may need to be converted to the same view coordinates as the path by calling

    - (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view
    

    or

    - (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view
    

    On your view.

    If the path is stored as a CGPath you can create a UIBezierPath from it using

    [UIBezierPath bezierPathWithCGPath:CGPath]; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIView that has several UIImageViews as subviews. Each of these subviews
I have several UIViews and UIImageViews that are loaded inside a UIScrollView. Each page,
I have a UIView that gets loaded with several custom NSObjects (graphShape). Each graphShape
I have a subclass of UIView that displays some Core Graphics drawn in a
Hi I have a UIView which contains several buttons that are designed by others
I have a subclassed UIView (currentMapView) that draws a map of several states using
I have overridden the drawRect: in my UIView and I want to draw several
I have a UIView called character. Inside that view the user can add several
I have several UIViews that are on my xib file and would like to
I have several UIView subclasses (buttons, labels, etc.) that follow the following setup pattern.

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.