• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Touch: Non-rectangular Touch areas
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Touch: Non-rectangular Touch areas


  • Subject: Re: Touch: Non-rectangular Touch areas
  • From: Jens Alfke <email@hidden>
  • Date: Sat, 6 Feb 2010 11:05:14 -0800

On Feb 6, 2010, at 10:54 AM, Development wrote:

> 	I have an app I am working on and several of the touch zones or buttons occur within a trapezoid. Because these trapezoids touch one another to complete a picture I need for the zones to be precise. What I'm not sure how to accomplish is allowing touch within the border of the trapezoid and not outside in it's broader rect. Is there way to define a touchable zone that is non-rectangular?

You can do the hit-testing yourself by getting the touch coords and seeing which trapezoid it's in.

The easiest way to do this is to create an NSBezierPath in the shape of the trapezoid and call -containsPoint: on it; but IIRC, that class doesn't exist on iPhone. Fortunately the math for hit-testing convex polygons is pretty easy: check any computer graphics textbook for details.

—Jens

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Touch: Non-rectangular Touch areas
      • From: Andrew Farmer <email@hidden>
References: 
 >Touch: Non-rectangular Touch areas (From: Development <email@hidden>)

  • Prev by Date: Touch: Non-rectangular Touch areas
  • Next by Date: Re: RegisterEventHotKey and keylogging
  • Previous by thread: Touch: Non-rectangular Touch areas
  • Next by thread: Re: Touch: Non-rectangular Touch areas
  • Index(es):
    • Date
    • Thread