The ModMyTM Family of Sites:
ModMyMotoModMyiModMyGphone




 
 
Register or Connect with Facebook

Discuss AppStore Apps | Browse / Search Cydia | MMi Cydia Stats




  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-21-2008, 01:20 PM
Livin the iPhone Life
 
Join Date: Dec 2007
Posts: 1,401
Thanks: 15
Thanked 173 Times in 165 Posts
Events: Swipes and Flicks

hy,
sorry to bother you all again

I tried putting up events today. I managed to put up tap-events just fine, I can recognize taps, doubletaps, tripletaps, whatever.

I encountered problems when trying to respond to a swipe gestures though.
This is my code:

Code:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
	UITouch *touch = [touches anyObject];
	if (touch.tapCount == 2 && touch.view == self) {
		//Stuff that should be done on double-tap. this works fine.
	}
	if (touch.info == UITouchSwipedRight) {
                //Everything in here is never executed
		UILabel *test = [[UILabel alloc] initWithFrame:CGRectMake(100,100,100,100)];
		test.text = @"Swiped to the right";
		test.font = [UIFont systemFontOfSize:20];
		[self addSubview:test];
	}
}
the part that should be executed when a right-swipe is detected is never executed, no matter what I do. I also tried
if (touch.info & UITouchSwipedRight)
according to the iphone OS programming guide, though I don't really know if it does matter.
why does this not work? The code is exactly the same as in the example in the iphone OS guide (chapter event handling) but it does not work.

also: how would I detect flick gestures? because flicks are way easier to do by the user than swipes, so I would like to respond to flicks and swipes.

thanks
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #2  
Old 03-22-2008, 12:53 PM
Green Apple
 
Join Date: Sep 2007
Posts: 43
Thanks: 0
Thanked 11 Times in 5 Posts

A swipe is a separate event from touches. There are a few samples up on the idevdocs.com sample code forum. There's a canHandleSwipes() you setup, as I recall.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #3  
Old 03-22-2008, 05:08 PM
Livin the iPhone Life
 
Join Date: Dec 2007
Posts: 1,401
Thanks: 15
Thanked 173 Times in 165 Posts

Quote:
Originally Posted by Cobra View Post
A swipe is a separate event from touches. There are a few samples up on the idevdocs.com sample code forum. There's a canHandleSwipes() you setup, as I recall.
thanks for your reply.

mh, can't really find anything about it there, sorry.
also, according to apples iphone OS development PDF, a swipe is also a touch. just a touch that has been moved in a specific direction. and normally that direction is stored in the info property of the touch, but when I try to determine whether or not a touch is a swipe it always returns false.

I wrote a own little routine that detects swipes now that works with the finger-position, but that's not the best solution to be honest.

PS: this is copied from apples PDF on how to determine a swipe:
Code:
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
    UITouch *touch = [touches anyObject];
    if (touch.info & UITouchSwipedRight) {
        [self showPreviousImage];
    } else if (touch.info & UITouchSwipeLeft) {
        [self showNextImage];
    }
    return;
}

Last edited by BlackWolf; 03-22-2008 at 05:11 PM..
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #4  
Old 03-23-2008, 01:26 AM
Green Apple
 
Join Date: Sep 2007
Posts: 43
Thanks: 0
Thanked 11 Times in 5 Posts

Oh, are you using toolchain or sdk? My comments are about the open toolchain. I think they changed the behavior for the sdk interface.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #5  
Old 03-23-2008, 03:35 AM
Livin the iPhone Life
 
Join Date: Dec 2007
Posts: 1,401
Thanks: 15
Thanked 173 Times in 165 Posts

Quote:
Originally Posted by Cobra View Post
Oh, are you using toolchain or sdk? My comments are about the open toolchain. I think they changed the behavior for the sdk interface.
oh, I thought they were quite alike. in that case: sdk.
but thanks for trying
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #6  
Old 11-09-2008, 11:35 AM
What's Jailbreak?
 
Join Date: Nov 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

BlackWolf,
How are you using touch.info and UITouchSwipedRight ?

I don't find these references in my SDK header files ?!
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #7  
Old 11-16-2008, 10:14 AM
Green Apple
 
Join Date: Nov 2008
Device + Firmware: 2g 2.1 firm unlock + jailbroken
Operating System: vista ultimate asus c90s
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts

yeah me neither
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion

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



Go to Top
ModMyI

All times are GMT -6. The time now is 05:59 AM. Powered by vBulletin® Version 3.8.4
If you need Dedicated Server Hosting, you should check out SingleHop. | Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 Copyright © 2007-09 by ModMy, LLC. All rights reserved.

iPhone News / iPhone Forums / Apple News / Apple Forums / RSS / Contact Us / / Privacy Statement / Top