HomeStoreForumsWikiiPhone Native AppsiPhone AppsiPhone Apps modmyifone Downloadsmodmyifone Links






Go Back   ModMyiFone.com | iPhone forums, iPhone hacks, iPhone unlock > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion
Register FAQ Members List READ THIS Today's Posts Mark Forums Read

iPhone / iPod Touch SDK | Development Discussion SDK questions. A place for iPhone developers to post code snippets, discuss creating iPhone apps, and any other iPhone developing.


iPhone Optimized MMi | Browser Optimized MMi

Get more out of ModMyiFone by joining our free community. By registering you get privileges to download files from our downloads section and you may also post your questions in our forums! It's fast, free, and easy!

Opportunities at MMi | 1.1.4 Unlock|Jailbreak OS X / Win
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-21-2008, 12:20 PM
Green Apple
 
Join Date: Dec 2007
Posts: 52
Thanks: 10
Thanked 5 Times in 5 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 (permalink)  
Old 03-22-2008, 11:53 AM
Green Apple
 
Join Date: Sep 2007
Posts: 40
Thanks: 0
Thanked 9 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 (permalink)  
Old 03-22-2008, 04:08 PM
Green Apple
 
Join Date: Dec 2007
Posts: 52
Thanks: 10
Thanked 5 Times in 5 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 04:11 PM.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #4 (permalink)  
Old 03-23-2008, 12:26 AM
Green Apple
 
Join Date: Sep 2007
Posts: 40
Thanks: 0
Thanked 9 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 (permalink)  
Old 03-23-2008, 02:35 AM
Green Apple
 
Join Date: Dec 2007
Posts: 52
Thanks: 10
Thanked 5 Times in 5 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
Reply

  ModMyiFone.com | iPhone forums, iPhone hacks, iPhone unlock > 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

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

ModMyMoto.com - ModMyGPhone.com - ModMyiFone.com - Managed Dedicated Servers by SingleHop - iPhone Wallpapers - Contact Us - Link to us - Archive - Privacy Statement - - Top
All times are GMT -6. The time now is 07:00 PM. Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5 Copyright © 2007-08, ModMyiFone.com Forum skin by poetic_folly
ModMyiFone.com is an independent publication and has not been authorized, sponsored, or otherwise approved by Apple, Inc or Cisco Systems, Inc. The information contained on this site is for educational purposes only.