swipe gestures
swipe gestures
- Subject: swipe gestures
- From: Jeremy Matthews <email@hidden>
- Date: Sun, 16 May 2010 13:29:05 -0400
So I'm working them into my app, and I noticed that I can't seem to use them in order to select a tabviewitem, but I can appear to do other things (logging, alerts, etc)?
I checked my IBOutlets and everything is kosher there...
Is there a limitation here I am unaware of?
I can use tabviewitem selection anywhere else...
- (void)swipeWithEvent:(NSEvent *)event
{
NSString *direction = nil;
if ([event deltaX] != 0) {
if ([event deltaX] > 0) {
direction = [[NSString alloc] initWithString:@"Left"];
NSLog(@"it is left");
NSAlert *theAlert = [[[NSAlert alloc] init] autorelease];
[theAlert addButtonWithTitle:@"OK"];
[theAlert setMessageText:@"Swiped!"];
[theAlert setInformativeText:@"To the left...."];
[theAlert setAlertStyle:0];
int rCode = [theAlert runModal];
if (rCode == NSAlertFirstButtonReturn) {
//NSLog(@"Chosen");
[myTabView selectTabViewItem:tabViewItem1];
return;
} else if (rCode == NSAlertSecondButtonReturn) {
//NSLog(@"Override chosen - user not selecting account - mail could be interesting...");
} else {
//NSLog(@"other");
}
}
else {
direction = [[NSString alloc] initWithString:@"Right"];
NSLog(@"it is right");
NSAlert *theAlert = [[[NSAlert alloc] init] autorelease];
[theAlert addButtonWithTitle:@"OK"];
[theAlert setMessageText:@"Swiped!"];
[theAlert setInformativeText:@"To the right...."];
[theAlert setAlertStyle:0];
int rCode = [theAlert runModal];
if (rCode == NSAlertFirstButtonReturn) {
//NSLog(@"Chosen");
[myTabView selectTabViewItem:tabViewItem1];
return;
} else if (rCode == NSAlertSecondButtonReturn) {
//NSLog(@"Override chosen - user not selecting account - mail could be interesting...");
} else {
//NSLog(@"other");
}
}
}
else if ([event deltaY] != 0) {
if ([event deltaY] > 0) {
direction = [[NSString alloc] initWithString:@"Up"];
NSLog(@"it is up");
}
else
{
direction = [[NSString alloc] initWithString:@"Down"];
NSLog(@"it is down");
}
}
NSLog(@"Swipe gesture detected. Direction: %@", direction);
if (direction) {
[direction release];
}
}
_______________________________________________
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