有人知道我们如何在 iOS 7 下模拟系统范围的触摸事件吗?
我们使用了以下曾经适用于 iOS 6 或更早版本的代码:
CGPoint location = .... ;
struct GSTouchEvent {
GSEventRecord record;
GSHandInfo handInfo;
GSPathInfo pathInfo;
uint32_t newIn6;
} * event = (struct GSTouchEvent*) &touchEvent;
bzero(touchEvent, sizeof(touchEvent));
event->record.type = kGSEventHand;
event->record.windowLocation = location;
event->record.timestamp = _GSCurrentEventTimestamp();
event->record.infoSize = sizeof(GSHandInfo) + sizeof(GSPathInfo);
event->handInfo.type = getHandInfoType(0, 1);
event->handInfo.pathInfosCount = 1;
event->handInfo.pathInfos[0].pathIndex = 1;
event->handInfo.pathInfos[0].pathIdentity = 2;
event->handInfo.pathInfos[0].pathProximity = 0x03 ;
event->handInfo.pathInfos[0].pathLocation = location;
GSSendEvent((GSEventRecord*)event, port);