我正在尝试模拟iOS 7上的"主页按钮",但iOS 6上使用的上一个方法不起作用.我说的是一个越狱装置.
#include "GSEvent.h"
- (void)simulateHomeButton
{
struct GSEventRecord record;
memset(&record, 0, sizeof(record));
record.type = kGSEventMenuButtonDown;
record.timestamp = GSCurrentEventTimestamp();
GSSendSystemEvent(&record);
record.type = kGSEventMenuButtonUp;
GSSendSystemEvent(&record);
}
Run Code Online (Sandbox Code Playgroud)
*更新我真正需要的是一种通用的方法,比如旧方法,让我模拟所有物理按钮的压力