Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-19-2011, 03:46 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 59
kend0g187 is on a distinguished road
Default get swipe location?

I need to trigger a different event depending on whether the user swipes the top of the screen, the middle of the screen, or the bottom of the screen. I'm trying to figure out the best/easiest way to do this, since I'm pretty sure that there is no way to get the location from UISwipeGestureRecognizer.

The first option is to create my own swipe recognizer using the 'touches' methods. This seems like it would be very difficult (trying to differentiate between a swipe and a drag, for example).

The second possibility is to get the location from one of the 'touches' methods (touchesBegan for example), and to somehow associate that with the swipe. Maybe set a timer in touchesBegan and then if the swipe recognizer fires within half-a-second or so I'll know that swipe was connected to that touch.

The third possibility I can think of is to lay 3 transparent subviews on top of my view and add a different swipe recognizer to each view. This seems like the best way to me except that transparent views don't recognize touch/swipe events. So how can I work around this?

Any suggestions? Thanks.
kend0g187 is offline   Reply With Quote
Old 04-20-2011, 04:00 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

what about use UIPanGestureRecognizer , so that you can retrieve the start and end points?

then you can discard pan(s) that have a difference abs(start.y - end.y) > LIMIT, so you will have just slides.
__________________
dany_dev is offline   Reply With Quote
Reply

Bookmarks

Tags
location, swipe, uiswipegesturerecognizer

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 346
13 members and 333 guests
dansparrow, dre, iOS.Lover, LezB44, lorrettaui53, Nobbsy, Objective Zero, oztemel, pbart, samdanielblr, sledzeppelin, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:49 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0