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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:06:40+00:00 2026-06-16T05:06:40+00:00

I managed to mask views using similar approach as here : How to mask

  • 0

I managed to mask views using similar approach as here : How to mask UIViews in iOS
But now I need to detect touches in this masked view. Gesture recognisers and buttons would detect touched in bounds area, basically ignoring the mask. So I think if I could get CGPath from my mask image, it would be easy to handle touches. Any suggestions about how to get CGPath from mask image?

  • 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-16T05:06:41+00:00Added an answer on June 16, 2026 at 5:06 am

    You could set the UIGestureRecognizer‘s delegate and override - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

    1 . Get the location of the touch in the recognizer’s view

    - (CGPoint)locationInView:(UIView *)view

    2 . Find out the alpha channel of the image at that location. For that, use this code (for efficiency, you can recalculate the transparent values ahead of time, for the whole image, and store them into a buffer so you don’t have to copy the alpha buffer every time. I kept it simple here and did it for a single pixel. If you want to see how to do the whole image at once, look at this post.

    unsigned char pixelData[1] = {0};
    CGContextRef context = CGBitmapContextCreate(pixelData, 1, 1, 8, 1, NULL, kCGImageAlphaOnly);
    UIGraphicsPushContext(context);
    [im drawAtPoint:CGPointMake(-point.x, -point.y)];
    UIGraphicsPopContext();
    CGContextRelease(context);
    CGFloat alphaChannel = pixel[0]/255.0;
    BOOL transparent = alphaChannel < 0.01;
    
    1. Based on that value, return YES or NO
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone managed to do this? I've tried using embed, object, and iframe, entered from
i managed using a SplitViewController in a TabBarApplication. The problem now is, trying to
I managed my original problem i had to add the break; but now the
very simple question here but I don't have the answer... ;-) I just need
I managed to create a dynamic three dropdown list using Javascript code and it
I managed to apply this excellent example to my needs: http://code.google.com/p/galleriffic/issues/attachmentText?id=76&aid=-3045121742886940548&name=example-2.html&token=4nlvmgAfVpc5whcXC9UEqHZaSz0%3A1339257750721 With a small
I managed to request the publish_actions permission, but since it is revocable from the
I managed to found out how to delete field but I have a problem
I managed to get the YUI calendar widget working fine. But When it displays
I am using joomla for loading some static content for my web application. now

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.