Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created singletap event on iOS. #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ios/Classes/TiDraggableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ - (id)init
if (self) {
isDraggable = YES;
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)];
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(tapDetected:)];
[self addGestureRecognizer:panRecognizer];
[self addGestureRecognizer:tapRecognizer];
[panRecognizer release];
[tapRecognizer release];
}
return self;
}
Expand Down Expand Up @@ -192,6 +195,25 @@ - (void)rotationDetected:(UIRotationGestureRecognizer *)rotationRecognizer
}


-(void)tapDetected:(UITapGestureRecognizer *) sender
{
if ( sender.state == UIGestureRecognizerStateEnded ) {
if([self.proxy _hasListeners:@"singletap"])
{
TiPoint *center = [self _center];
left = self.frame.origin.x;
top = self.frame.origin.y;
NSDictionary *tiProps = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:left], @"left",
[NSNumber numberWithFloat:top], @"top",
center, @"center",
nil];
[self.proxy fireEvent:@"singletap" withObject:tiProps];
}
}
}


// ========================================================================

#pragma mark JavaScript properties
Expand Down