title: How to use CGRectContainsPoint() with rotated UIView
body: <p>I have a <code>UIView</code>, and the user can tap the <code>UIView</code> to 'select' or highlight the in-app 'thing' that it represents. I use <code>CGRectContainsPoint(thing.frame,tapPoint)</code> to achieve this, where <code>thing.frame</code> is the frame of the <code>UIView</code>, and <code>tapPoint</code> is the tapped point from a <code>UITapGestureRecognizer</code>. This works perfect.</p>
  
  <p>..except when <code>UIView</code> is rotated by setting the <code>transform</code> property (with a <code>CGAffineTransform</code> value). When the <code>UIView</code> is rotated like this, the <code>frame</code> becomes a flat square that encapsulates the rotated view.</p>
  
  <p>Here is an illustration of the problem (frame property is labeled A, and the visual <code>UIView</code> <code>bounds</code> are labeled B):</p>
  
  <p><strong>When NOT Rotated</strong></p>
  
  <pre><code>+------------------+
  |      A == B      |
  +------------------+
  </code></pre>
  
  <p><strong>When Rotated</strong></p>
  
  <pre><code>+-----------------+
  |  A        .     |
  |         .   .   |
  |       .       . |
  |     .       .   |
  |   .    B  .     |
  | .       .       |
  |   .   .         |
  |     .           |
  +-----------------+
  </code></pre>
  
  <p>I want to capture taps that are within the bounds of rect <code>B</code> (the true bounds of <code>UIView</code>, rotated), but NOT when they're only within rect <code>A</code> (the value of the <code>frame</code> property of <code>UIView</code>) and not <code>B</code>.</p>
  
  <p>How might I calculate whether a given tap point is within the true bounds/frame/borders of the rotated <code>UIView</code>? Is there a convenience method for this? Or would I need to calculate the coordinates and dimensions of <code>B</code> using my own geometry?</p>
  
  <p>(If the latter, please include a suggestion so we can make the answer as complete as possible. Thanks!)</p>