[TIMOB-4508] iOS: Need the pinch gesture exposed for TIUIView event listeners
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-09-13T13:28:19.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2011-37, Release 1.8.0 |
Components | iOS |
Labels | module_views |
Reporter | John V Pataki |
Assignee | Reggie Seagraves |
Created | 2011-06-27T14:46:46.000+0000 |
Updated | 2017-03-21T18:27:18.000+0000 |
Description
We need to have the event handler for pinch gestures available for TIUIView objects and their derivatives
This is needed for many projects we've been a apart of.
We recently implemented this in the soon to be available openGL module development project (ios only so far) and it seems to work for our needs there.
Having this available for all views and objects that are based on view objects would be very useful.
Here are the code snippets from the IOS side:
Added this to the view initialization:
UIPinchGestureRecognizer *pinchRecognizer;
pinchRecognizer=[[UIPinchGestureRecognizer alloc]
initWithTarget:self
action:@selector(foundPinch:)];
[controller.view addGestureRecognizer:pinchRecognizer];
[pinchRecognizer release];
here's the callback:
- (void)foundPinch:(UIPinchGestureRecognizer *)recognizer {
NSDictionary *event = [NSDictionary dictionaryWithObjectsAndKeys:NUMDOUBLE(recognizer.scale), @"scale", NUMDOUBLE(recognizer.velocity), @"velocity", nil];
[self.proxy fireEvent:@"pinch" withObject:event];
}
here's how we use it now on the opengl view
opengl.addEventListener('pinch', function {
scale = e.scale;
});
Per our conversation, assigning to you
While the pinch is being added, the enterprise customer project that needs the "pinch" also needs "long press". It seems reasonable that the effort here can expose both of these gestures together.
Doc reviewed, merged.
We will be testing this based on the AppC customer requirement to use it... which involves being able to pinch to zoom & rotate an image view. I suspect by default pinch exposes the scale property. What will we have to do in ti js to best be able to implement being able to rotate and also pan the view along with pinch to zoom? Is there a recommended way to do this based on they way pinch has been exposed through the module?