On Jun 10, 10:48 am, Krukow <
karl.kru...@gmail.com> wrote:
> On Jun 10, 10:35 am, Krukow <
karl.kru...@gmail.com> wrote:> My current problem is that I need a gesture (swipe) to interact with a
> > view. UISpec doesn't seem to support it.
>
> [snip]
>
> I just found this thread
>
>
http://groups.google.com/group/frank-discuss/browse_frm/thread/458742...
>
> I'll take a look and see if I can implement swipe in uispec.
I'm running into problems with this.
I was trying to extend UISpec to support swipe events. UISpec is based
on the article
http://cocoawithlove.com/2008/10/synthesizing-touch-event-on-iphone.html
My initial naive attempt was to simply mirror the touch method but
injecting some
UITouchPhaseMoved steps. But it didn't work. I was wondering about
the GSEventProxy.
Specifically the line
gsEventProxy->flags = ([touch phase] == UITouchPhaseEnded) ?
0x1010180 : 0x3010180;
It seems it only distinguishes between end and non-end. But I don't
know if this is the problem.
Note I'm running simulator 4.3.
In the EmployeeAdmin app if you right swipe on a table row it enters
"delete mode". This is what I'm trying to script. However nothing
happens
This was my naive code for a swipe
UITouch *touch = [[UITouch alloc] initInView:view];
UIEvent *eventDown = [[NSClassFromString(@"UITouchesEvent") alloc]
initWithTouch:touch];
NSSet *touches = [[NSMutableSet alloc] initWithObjects:&touch count:
1];
[touch.view touchesBegan:touches withEvent:eventDown];
BOOL done = NO;
CGPoint currentLoc = *((CGPoint*)[touch locationInWindow]);
while (!done) {
UIEvent *eventMove =
[[NSClassFromString(@"UITouchesEvent") alloc] initWithTouch:touch];
CGPoint oldLoc = currentLoc;
currentLoc = CGPointMake(currentLoc.x+2, currentLoc.y);
[touch setLocationInWindow:currentLoc];
[touch setPreviousLocationInWindow:oldLoc];
[touch setPhase:UITouchPhaseMoved];
[touch.view touchesMoved:touches withEvent:eventMove];
[eventMove release];
done = (currentLoc.x - view.center.x >50);
// [self wait:.01];
}
UIEvent *eventUp = [[NSClassFromString(@"UITouchesEvent") alloc]
initWithTouch:touch];
[touch setPhase:UITouchPhaseEnded];
[touch setLocationInWindow:currentLoc];
[touch.view touchesEnded:touches withEvent:eventDown];