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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:48:55+00:00 2026-06-16T07:48:55+00:00

I have a UIView , and the user can tap the UIView to ‘select’

  • 0

I have a UIView, and the user can tap the UIView to ‘select’ or highlight the in-app ‘thing’ that it represents. I use CGRectContainsPoint(thing.frame,tapPoint) to achieve this, where thing.frame is the frame of the UIView, and tapPoint is the tapped point from a UITapGestureRecognizer. This works perfect.

..except when UIView is rotated by setting the transform property (with a CGAffineTransform value). When the UIView is rotated like this, the frame becomes a flat square that encapsulates the rotated view.

Here is an illustration of the problem (frame property is labeled A, and the visual UIView bounds are labeled B):

When NOT Rotated

+------------------+
|      A == B      |
+------------------+

When Rotated

+-----------------+
|  A        .     |
|         .   .   |
|       .       . |
|     .       .   |
|   .    B  .     |
| .       .       |
|   .   .         |
|     .           |
+-----------------+

I want to capture taps that are within the bounds of rect B (the true bounds of UIView, rotated), but NOT when they’re only within rect A (the value of the frame property of UIView) and not B.

How might I calculate whether a given tap point is within the true bounds/frame/borders of the rotated UIView? Is there a convenience method for this? Or would I need to calculate the coordinates and dimensions of B using my own geometry?

(If the latter, please include a suggestion so we can make the answer as complete as possible. 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-06-16T07:48:56+00:00Added an answer on June 16, 2026 at 7:48 am

    You’re discovering the one fundamental stumbling block that everybody has when they first work for frame and bounds.

    Frame is the smallest possible (non-rotated) rectangle in which a view fits in, taking into account transformation. Meaning, if you were to test for touches, you could log in the available space around the view so long as it was within that smallest possible rectangle.

    For the visual, imagine the blue square is a transformed UIView. The blue border around the view represents it’s frame. Notice how, even though the view is transformed, that it’s frame remains un-transformed and in standard position. The green area represents the areas that are touchable if frame is passed instead of bounds:

    frame

    Bounds, on the other hand, represents the reciever’s rectangle with respect to itself, taking into account transformations, and so testing for points in the view by passing bounds (after a -convertPoint:toView: call) will correctly return whether or not a given touch (point) intersects the view.

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

Sidebar

Related Questions

I have a UIView I'm animating in so that the user can select something
I have a subview in my app that contains a UIImageView. The user can
I have a UIView that a user can add subviews to. I now need
I have a UIView called character. Inside that view the user can add several
I have an application that starts playing a sound when user touches the uiview
I have some a UIView with several user created subviews. The user can move
I have a UIView that I want to load when the user clicks a
I have UIView that open with a UIButton click. I want to disable user
I have one large view with a toolbar that allows a user to select
I'm trying to create a UIView that allows a user to tap a button

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.