如何在iOS上使用GSEvent模拟触摸移动事件?

如何在iOS上使用GSEvent模拟触摸移动事件?,ios,objective-c,jailbreak,Ios,Objective C,Jailbreak,通过在stackoverflow中搜索,我了解了如何在iOS上模拟触地事件,但经过多次尝试,我没有了解如何使用GSEvent创建触地移动事件,有人知道吗 模拟着陆事件: static void sendclickevent() { CGPoint location = CGPointMake(200, 288); // structure of touch GSEvent struct GSTouchEvent { GSEventRecord record; GSHandIn

通过在stackoverflow中搜索,我了解了如何在iOS上模拟触地事件,但经过多次尝试,我没有了解如何使用GSEvent创建触地移动事件,有人知道吗

模拟着陆事件:

static void sendclickevent() {

CGPoint location = CGPointMake(200, 288);

// structure of touch GSEvent
struct GSTouchEvent {
    GSEventRecord record;
    GSHandInfo    handInfo;
} * event = (struct GSTouchEvent*) &touchEvent;
bzero(touchEvent, sizeof(touchEvent));

// set up GSEvent
event->record.type = kGSEventHand;
event->record.windowLocation = location;
event->record.timestamp = GSCurrentEventTimestamp();
event->record.infoSize = sizeof(GSHandInfo) + sizeof(GSPathInfo);
event->handInfo.type = kGSHandInfoTypeTouchDown;
if (is_50_or_higher){
    event->handInfo.x52 = 1;
} else {
    event->handInfo.pathInfosCount = 1;
}
bzero(&event->handInfo.pathInfos[0], sizeof(GSPathInfo));
event->handInfo.pathInfos[0].pathIndex     = 1;
event->handInfo.pathInfos[0].pathIdentity  = 2;
event->handInfo.pathInfos[0].pathProximity = 1 ? 0x03 : 0x00;;
event->handInfo.pathInfos[0].pathLocation  = location;

mach_port_t port = (mach_port_t)getFrontMostAppPort();
GSSendEvent((GSEventRecord *)event, port);
}
你触地得分,你也触地得分,对吗

一次轻触如下所示:

   touchdownAtPoint(x,y);
   wait(0.1);//wait for 0.1 sec
   touchUpAtPoint(x,y);
    touchdownAtPoint(x,y);
     touchdownAtPoint(x+1,y);//scroll to right?
    touchdownAtPoint(x+2,y);
     .................
     touchdownAtPoint(x+n,y);
     touchUpAtPoint(x+n,y);
当你想做一个触摸动作时,应该是这样的:

   touchdownAtPoint(x,y);
   wait(0.1);//wait for 0.1 sec
   touchUpAtPoint(x,y);
    touchdownAtPoint(x,y);
     touchdownAtPoint(x+1,y);//scroll to right?
    touchdownAtPoint(x+2,y);
     .................
     touchdownAtPoint(x+n,y);
     touchUpAtPoint(x+n,y);
当然,您应该为它编写自己的循环。不管怎么说,我不知道这是否是最正确的方法,但我成功了

你触地得分,你也触地得分,对吗

一次轻触如下所示:

   touchdownAtPoint(x,y);
   wait(0.1);//wait for 0.1 sec
   touchUpAtPoint(x,y);
    touchdownAtPoint(x,y);
     touchdownAtPoint(x+1,y);//scroll to right?
    touchdownAtPoint(x+2,y);
     .................
     touchdownAtPoint(x+n,y);
     touchUpAtPoint(x+n,y);
当你想做一个触摸动作时,应该是这样的:

   touchdownAtPoint(x,y);
   wait(0.1);//wait for 0.1 sec
   touchUpAtPoint(x,y);
    touchdownAtPoint(x,y);
     touchdownAtPoint(x+1,y);//scroll to right?
    touchdownAtPoint(x+2,y);
     .................
     touchdownAtPoint(x+n,y);
     touchUpAtPoint(x+n,y);

当然,您应该为它编写自己的循环。无论如何,我不知道这是否是最正确的方法,但我成功了。

我不确定,但你可以尝试创建更多的pathInfo's我不确定,但你可以尝试创建更多pathInfo's谢谢你的回答,但你确定吗?我想通过多次触地模拟触地移动是行不通的。是的,Bob,我在IOS4.3中实现了这一点,IOS5和最新的IOS6。谢谢你的回答,但是你确定吗?我认为通过多次触地模拟触地移动是不可行的。是的,鲍勃,我已经在IOS4.3、IOS5和最新的IOS6中成功了。