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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:30:49+00:00 2026-05-15T21:30:49+00:00

I’m trying to place a circular image on an iPhone view and then consume

  • 0

I’m trying to place a circular image on an iPhone view and then consume taps inside the circle but not outside of it. The problem I’m running into is that when I place a UIImageView on the screen view in Interface Builder, I seem to be constrained to a rectangular shape. I tried using an image of a circle with the area outside the circle left as transparent but the image in total is still rectangular, so when it’s placed on a UIImageView and hooked up to recognize tap gestures it still picks up the taps outside the circle itself.

The image below shows what I mean. The blue dots represent the outer border of the UIImageView that holds the image. The tap gesture recognition is currently linked to that UIImageView but as you can see, there is a bit of space at the corners of the UIImageView that are not covered by the circular image. Is there any way to either conform a UIImageView to a non-rectangular shape or to place an image on a View without using a UIImageView and still be able to hook up tap recognition?

image of walter with transparent background on a UIImageView http://img237.imageshack.us/img237/2164/walterheadshot.png

I’m pretty new to iPhone graphics but does anyone have some ideas on this or can point me in the right direction?

Thanks!

  • 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-15T21:30:49+00:00Added an answer on May 15, 2026 at 9:30 pm

    Assumes a circle, and not just an oval:

    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
    {
        CGFloat halfSize = [self bounds].size.width * 0.5f;
        CGPoint location = [[touches anyObject] locationInView:self];
        location.x -= halfSize;
        location.y -= halfSize;
        CGFloat squaredDistanceFromCenter = location.x * location.x + location.y + location.y;
        if (squaredDistanceFromCenter < (halfSize * halfSize)) {
            NSLog(@"Within circle :)");
        } else {
            NSLog(@"Not within circle :(");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm trying to select an H1 element which is the second-child in its group

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.